Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. Declare @sql as nvarchar(max)
  2. Declare @TBL as nvarchar(max)
  3. Declare @Name_Edit nvarchar(max)
  4. Declare @Name1 as nvarchar(max)= N'B'
  5. Declare @Price as nvarchar(max) = N'12'
  6. Declare @NameTBL as nvarchar(max) = N'KeyBoard'
  7.  
  8.  
  9.  
  10. set @Name_Edit = N'A'
  11. set @TBL = N'TBL_Price'+NameTBL
  12. Set @sql = N'INSERT INTO [DB1].[dbo].'+quotename(@TBL) +'
  13. (
  14. [Name_Edit]
  15. ,[Name1]
  16. ,[Price]
  17. )
  18. VALUES
  19. (
  20. '+@Name_Edit+'
  21. ,'+@Name1+'
  22. ,'+@Price+'
  23. )'
  24. -- exec (@sql)
  25. EXECUTE sp_executesql @sql
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement