February 1, 2010 at 4:33 pm
In T-SQL, I was almost positive the double pipe ' || ' could be used to merge statements together, like it's done in Oracle or Informix. Am I crazy?
select "select count(*) from " || name from sys.tables
The above syntax doesn't work, did I mix the syntax up? Google search is maddening, but did find an article about voting in the double pipe operator. Does anyone else use this?
----------------------------------------------------------------------------
Sacramento SQL Server users group - http://sac.sqlpass.org
Follow me on Twitter - @SQLDCH
----------------------------------------------------------------------------
February 1, 2010 at 5:58 pm
oracle is double pipe; SQL Server uses the plus sign, and will only concat the char datatypse(char/varchar/nchar/nvarchar); so of you need to concat an integer to the string , you have to explicitly convert it, ie:
select 'Records found' + convert(varchar,50) + '.'
Lowell
Viewing 2 posts - 1 through 1 (of 1 total)
You must be logged in to reply to this topic. Login to reply