Search This Blog

Friday, March 1, 2013

Print SQL Server Example

SQL Server > Print

Print returns a user-defined message to the client.
The message string can be up to 8000 characters long

Example

declare @p int = 0
while @p < 10
begin
       print 'val ' + cast( @p as nvarchar(10))
    set @p = @p + 1
end

Result:

val 0
val 1
val 2
val 3
val 4
val 5
val 6
val 7
val 8
val 9