I need to execute a large set of SQL statements (creating a bunch of tables, views and stored procedures) from within a C# program.
These statements need to be separated by GO
statements, but SqlCommand.ExecuteNonQuery()
does not like GO
statements. My solution, which I suppose I'll post for reference, was to split the SQL string on GO
lines, and execute each batch separately.
Is there an easier/better way?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…