Last active
December 28, 2015 01:21
-
-
Save kiyokura/c8c85bd789185eb070d9 to your computer and use it in GitHub Desktop.
EXECUTEで実行できるのと出来ないのと
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DECLARE @arg varchar(MAX) = 'HOGEHOGE' | |
DECLARE @A varchar(MAX) = 'SELECT ''' + LEFT(@arg,4) + ''' as col1' | |
-- col1:HOGEで結果が返る | |
EXECUTE(@A) | |
-- エラーで実行できない | |
EXECUTE('SELECT ''' + LEFT(@arg,4) + ''' as col1') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment