tsql - Inserting Values into Dynamic Sql within a stored procedure - Where do the ticks go? -
I am trying to create a SQL statement in TSQL which looks like this:
in user tab Enter (Username) Value (Username)
It is as easy as you are not trying to do it in T-SQL and @username is varchar
< P> Looks like this: SELECT @SQLInsert = 'Use in user (user name)' + 'value (' + @ username ')' < / Code>
In addition to the course it does not work how much tick do I need to make a string in the string ???? I'm getting mad!
I think the problem is that you're not quoting the user name string properly such that To use the parameter query using the best practices method (and safe methods), how would this be done using sp_executesql (untested) I hope this would be helpful.
DECLARE @SQLInsert NVARCHAR (500) DECLARE @ Paramdif NVARCHAR (500) SET @SQLInsert = 'Enter userTable (username) values (@InsUserName)' SET @paramDef = '@InsUserName NVHARA (50) 'exposed spave extecqual @ sqlnsart, @ palam deaf, insusaram = @ usernames;
Comments
Post a Comment