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.
結果リストから挿入ステートメントを作成する簡単な方法はありますか? 何千もの行をインポートする必要があり、Excel ではなく insert() ステートメントとして使用することをお勧めします。
結果を取得する代わりに、動的 SQL を使用して挿入ステートメントを生成できます。
クエリから
select columnname from mytable
挿入ステートメントを生成できます
declare @sql nvarchar(max) = '' select @sql = @sql + N'insert into mytable(columnname) values (' + columnname + N'); ' from mytable print @sql