Bunch's Blog

One day I'll have a catchy subtitle, one day
posts - 87 , comments - 122 , trackbacks - 0

October 2011 Entries

PRINT Ints in TSQL
To print multiple int variables on one line you need to CAST them first. Otherwise the PRINT command will add them up (at least it does for me anyways using SQL 2008). In the example I needed to have two ID variables print out while I was working on a sproc so I could see if I was getting the correct IDs before adding in my update code. This did not work, it adds the two variables together: PRINT @FirstID + ‘ – ‘ + @NextID This does work, it prints each variable with the dash in-between: PRINT CAST(@FirstID ......

Posted On Thursday, October 20, 2011 10:48 AM | Comments (0) |

Powered by: