Hi @Coreysan
Can the example in this official document help you?
Best regards,
Percy Tang
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
(Special thanks to Erland, who helped me get going with CLR. I love this stuff!)
I have a stored proc with a hard-coded table:
ALTER PROCEDURE [dbo].[MSO_InsertMemberCheckData]
(
@myTableType MyTableType readonly
)
AS
BEGIN
CREATE TABLE MSO.dbo.tmp220(idx int identity(1, 1) primary key, wstr varchar(2000))
INSERT INTO MSO.dbo.tmp220 select wstr from @myTableType
END
How can I get this to work if I pass in the table name as a parameter? I've tried dynamic sql, but I don't know how to build a string with the user type @myTableType.
I think a better question is: why do you want the table name to be dynamic? In very many cases, this desire is due to a mistake in the design. You probably want one single table, with a key column that distinguishes these small tables you had intended to create.