To Execute Dynamic SQL command in SQL Server

Amatya
Posted by Amatya under Sql Server category on | Points: 40 | Views : 703
To Execute Dynamic SQL command in SQL Server

DECLARE @Cmd varchar(1000)
DECLARE @TagNo varchar(75)
SET @TagNo = '''XI-208B'''
SET @Cmd = 'SELECT * from tblAmatya where TagNo = ' + @TagNo
EXEC (@Cmd )


Thanks
Amatya

Comments or Responses

Login to post response