Suppose in sql server there is one variable
@String Varchar(max)
Now in this variable you want to store a string like this
Select * From Student_Table Where std_Name Like 'Mah%'
Suppose you are making statement as given below
Set @String='Select * From Student_Table Where std_Name Like 'Mah%''
But this will give you error.
To solve this problem you can use QUOTENAME function of SQL like given below.
Set @String='Select * From Student_Table Where std_Name Like ' + QUOTENAME('Mah%',Char(39))
Where Char(39) is ( ' ) character.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment