Answers for "DataTable TableName = Select("formname.variable", new object[1] {Name() })"

SQL
0

How should I pass a table name into a stored proc?

SELECT @ActualTableName = QUOTENAME( TABLE_NAME )
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = @PassedTableName

DECLARE @sql AS NVARCHAR(MAX)
--SELECT @sql = 'SELECT COUNT(*) FROM [' + @ActualTableName + '];'

-- changed to this
SELECT @sql = 'SELECT COUNT(*) FROM ' + @ActualTableName + ';'

EXEC(@SQL)
Posted by: Guest on May-27-2020

Code answers related to "DataTable TableName = Select("formname.variable", new object[1] {Name() })"

Code answers related to "SQL"

Browse Popular Code Answers by Language