Collections:
PRINT Statements in SQL Server Transact-SQL
How to print value on console in SQL Server Transact-SQL? How to use the PRINT statements?
✍: FYIcenter.com
In Transact-SQL, you can use PRINT statements to print values
on the console of the client tool, in the syntax of:
PRINT <value>
When a PRINT statement is executed, the system will:
Here are some examples on how to print values on the console:
-- Print the value from a literal PRINT 9.99; ---- 9.99 -- Print the value from a variable DECLARE @price MONEY; SET @price = 9.99; PRINT @price; ---- 9.99 -- Convert a number to DATETIME, the print DECLARE @when DATETIME; SET @when = 0.25; PRINT @when; ------------------- Jan 1 1900 6:00AM PRINT 'What time is it?'; PRINT GETDATE(); ------------------- What time is it? Oct 16 2017 9:00PM PRINT 'What time is it?'; PRINT 'It''s '+CAST(GETDATE() AS NVARCHAR(30)); ------------------------ What time is it? It's Oct 16 2016 9:02PM
⇒ CONVERT/CAST Function in SQL Server Transact-SQL
⇐ SET Statements in SQL Server Transact-SQL
2017-04-01, 3832🔥, 0💬
Popular Posts:
How To Replace Given Values with NULL using NULLIF() in SQL Server Transact-SQL? Sometime you want t...
How To Start MySQL Server in MySQL? If you want to start the MySQL server, you can run the "mysqld" ...
Can Date and Time Values Be Converted into Integers in SQL Server Transact-SQL? Can date and time va...
How To Calculate DATETIME Value Differences Using the DATEDIFF() Function in SQL Server Transact-SQL...
What Is the Difference Between GETDATE() and GETUTCDATE() in SQL Server Transact-SQL? The difference...