Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
SQLでそのようなことをすることは可能ですか?
DECLARE @t Nvarchar(50) SET @t = 'SELECT * FROM KIN_PHON' execute @t --??
使用exec:
exec
DECLARE @t Nvarchar(50) SET @t = 'SELECT * FROM KIN_PHON' exec (@t)
またはパラメーターを使用すると、sp_executesql次のようになります。
sp_executesql
declare @sql nvarchar(max) set @sql = 'select * from YourTable where ID = @ID' execute sp_executesql @sql, N'@ID int', @ID = 42;