Copying Table structure (using VB rdo and SQL)
Posted on 2003-03-06
I am trying to make a copy of a table during run-time using visual basic. I need to be able to make an exact replica of a table. Something like this command
select * from <table> into <table-copy>
Except that I don't want to use Select Into. I tried using the built in system stored procedures (sp_helpindex, sp_helpconstraint...) in SQL server but I am stuck with the sp_helpconstraint procedure. I was not able to retrieve the value in the final column(constraint_keys). I got an error 'Invalid cursor position'. Same thing happened with sp_helpindex. Can access all the columns except for the last one. This is not getting me anywhere.
Is there an easier way to copy a table whose structure I do not know or can you tell me how I can solve the problem with accessing the final columns of the procedure.