I want to run a big set of SQL statements in one go in c#; this SQL also contains numerous local variables. I tried to run that SQL using ADO.Net but I got an exception: "Cannot declare more than 10000 local variables". Can I run these SQL statements in a batch file (using c#) to avoid this exception/limitation? If yes, how? Is there any better approach?
I am using SQL Server 2008 R2 and C# 4.0.
Looking forward to assistance.
"Cannot declare more than 10000 local variables"
I expect that's a SQL Server limitation (albeit not listed in " Maximum Capacity Specifications for SQL Server "), if correct then all methods of running at a single script will have the same problem.
Better to break it up into smaller pieces—this should also make maintenance much easier.
You could create a .bat file that runs sqlcmd and exec your batch sql file. in c# you can then launch a cmd window as a process, sending the location of the .bat file as an argument.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.