CVens
asked on
Server: Msg 203, Level 16, State 2 error - HELP!
I am attempting to write a dynamic SQL script that will work on databases with against databases with varying dimensionality.
Basically I planned on first figuring out how many dimensions the system would have. Then since the related data tables would be different widths, go through a loop building the SQL statement in a varaible. Then I could just execute the variable string.
When I try to EXEC the string and I get the
Server: Msg 203, Level 16, State 2 error.
But if I just PRINT the variable the statement is fine and will run if I copy it into a new SQL window and run it.
Any thoughts?
Should I be doing this differently?
Thanks
Basically I planned on first figuring out how many dimensions the system would have. Then since the related data tables would be different widths, go through a loop building the SQL statement in a varaible. Then I could just execute the variable string.
When I try to EXEC the string and I get the
Server: Msg 203, Level 16, State 2 error.
But if I just PRINT the variable the statement is fine and will run if I copy it into a new SQL window and run it.
Any thoughts?
Should I be doing this differently?
Thanks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER