sql >> データベース >  >> RDS >> Sqlserver

sp_executesql でのテーブル変数の使用

    テーブル値パラメーターを sp_executesql に渡す方法の例を次に示します。 .変数は readonly で渡す必要があります :

    if exists (select * from sys.types where name = 'TestTableType')
        drop type TestTableType
    
    create type TestTableType as table (id int)
    go
    declare @t TestTableType
    insert @t select 6*7
    
    exec sp_executesql N'select * from @var', N'@var TestTableType readonly', @t
      

    これは、生命、宇宙の究極の質問への回答を出力します、そしてすべて .



    1. SQL Serverでマテリアライズドビューを作成するにはどうすればよいですか?

    2. MySQLデータベースのバックエンドへのフロントエンドとしてMSAccessを使用する際の問題?

    3. SQLiteはPRINTF()の名前をFORMAT()に変更します

    4. SQLServerで選択した行を手動で編集する