Hi I want to know how can we use single quotted string as a part of dynamic sql
Consider the following code
exec('select branchid from '+@tablename+' where Entrystatus='NE W' AND BranchName= '+@branchname')
In the above query New is string like 'NEW'and BranchName is also a string so how am I suppose to write single quotes?
wht is the main funda behind using them?
thnks
Consider the following code
exec('select branchid from '+@tablename+' where Entrystatus='NE W' AND BranchName= '+@branchname')
In the above query New is string like 'NEW'and BranchName is also a string so how am I suppose to write single quotes?
wht is the main funda behind using them?
thnks
Comment