Re: Simple Select Statement
Quote:
Originally Posted by
hamtaro^-^
Hi guys can you please take a look at this :D
Below is my sample script
Code:
DECLARE @sku nvarchar(100)
SELECt @sku = sku from ac_orderItems where orderID = 12 and orderItemTypeID = 0
Print Chr(39) || @sku || chr(39)
Then when i print @sku it give me a result of SampleB
but i want to produced an output of 'SampleB' enclosed in a single quote.
Thanks
Will that work?
:wave:
Re: Simple Select Statement
For SQL Server change || to +
Re: Simple Select Statement
'chr' is not a recognized function name, use char instead.
Code:
Print char(39) + @sku + char(39)
Re: Simple Select Statement
SQL Server has a string function called QuoteName. The syntax is
QUOTENAME ( 'character_string' [ , 'quote_character' ] )
'quote_character' can be a single quotation mark ('), a left or right bracket ([] - default), or a double quotation mark (").
Code:
DECLARE @sku nvarchar(100)
SELECt @sku = QuoteName(sku,'''') from ac_orderItems where orderID = 12 and orderItemTypeID = 0
Print @sku
Re: Simple Select Statement
Quote:
Originally Posted by
GaryMazzone
For SQL Server change || to +
Quote:
Originally Posted by
dee-u
'chr' is not a recognized function name, use char instead.
Code:
Print char(39) + @sku + char(39)
This is how Microsoft confuses PL/SQL developers. :p
:wave: