Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Create table using cursor

Author  Topic 

anjaliv
Starting Member

10 Posts

Posted - 2011-06-27 : 16:44:21
Hi All,

I am creating a table using cursor and it gets created in tempdb. Even if i specify the database, it gets ignored. How can I create a table in a particular database?

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-06-27 : 16:48:25
You'll have to post your code before we can help. And why are you using cursors to create tables?
Go to Top of Page

anjaliv
Starting Member

10 Posts

Posted - 2011-06-28 : 11:28:03
I have a table which contains the name of the tables and name of the database associated with it. I am running a cursor through each table and finding metadata of each table and storing it in a new table.
I was not able to create a new table in particular database, it used to get created in tempdb. But the problem is solved and I am able to create a table inside a cursor.
Thanks!!
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-06-28 : 11:52:43
Wow.
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2011-06-28 : 12:36:26
Could be worse I guess, could be stored as XML.
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2011-06-28 : 12:37:41
Good point. Now I feel better.
Go to Top of Page

anjaliv
Starting Member

10 Posts

Posted - 2011-06-28 : 13:06:20
I know its bad but I am very new to this and I am analyzing the whole database to find out which tables/SPs etc needs to be removed. This was a part of collecting the metadata together.
Thank you for your input!
Go to Top of Page
   

- Advertisement -