Hi @itay4
You use a stored procedure to pass parameters, do you want to implement dynamic insertion?
I did a test of dynamic insertion before.
DECLARE @sSQL nvarchar(400)
DECLARE @TableName nvarchar(max)
DECLARE @ColName nvarchar(max)
DECLARE @Insert nvarchar(max)
set @TableName = 'test'
set @ColName = 'A'
set @Insert = 'j24h'
set @sSQL = N'INSERT INTO ' + @TableName + '(' + @ColName + ')' + ' VALUES (' + QUOTENAME(@Insert,'''') + ');'
print @sSQL;
Exec sp_executesql @sSQL,N'@TableName nvarchar(max),@ColName nvarchar(max),@Insert nvarchar(max)',@TableName,@ColName,@Insert;
If you need to write into stored procedures, you can refer to this official document, which contains an example of dynamic insertion.
If what you need is not to implement dynamic insertion, but to debug your code, you need to expose your code.
Best regards,
Percy Tang