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 2000 Forums
 SQL Server Development (2000)
 sql query

Author  Topic 

claire99
Starting Member

17 Posts

Posted - 2003-02-04 : 16:56:52
I am new in sql. I'd like to rename a table. Can anyone know sql query about it? Thanks in advance.



-------------------
"And we know that all things work together for good to them that love God, to them who are the called according to his purpose." --- Roman 8:28

nr
SQLTeam MVY

12543 Posts

Posted - 2003-02-04 : 17:07:23
look at sp_rename

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

claire99
Starting Member

17 Posts

Posted - 2003-02-04 : 18:07:58
I need to use this query in sql sever 2000 DTS. I'm using "EXEC sp_rename 'table_n', 'table'" but it is showing below error message:
"could not find the object "sp_name"... Anyone can help? Thanks in advance!



-------------------
"And we know that all things work together for good to them that love God, to them who are the called according to his purpose." --- Roman 8:28
Go to Top of Page

robvolk
Most Valuable Yak

15732 Posts

Posted - 2003-02-04 : 18:13:29
Include the database name (master) when executing sp_rename:

EXEC master..sp_rename 'table_n', 'table'

Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2003-02-04 : 18:28:55
DTS?

Just execute it in query analyser.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

claire99
Starting Member

17 Posts

Posted - 2003-02-04 : 18:30:41
New error message when i added the database name
"is not a stored procedure"



-------------------
"And we know that all things work together for good to them that love God, to them who are the called according to his purpose." --- Roman 8:28
Go to Top of Page

nr
SQLTeam MVY

12543 Posts

Posted - 2003-02-04 : 19:04:04
Something strange going on

try

select * from master..sysobjects where type = 'P' order by name

And look for sp_rename

also are you working in v6.5 emulation mode? Don't know if that would make a difference.

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

claire99
Starting Member

17 Posts

Posted - 2003-02-05 : 10:44:01
Thanks to all!
EXEC sp_rename table_o, table_n works!



-------------------
"And we know that all things work together for good to them that love God, to them who are the called according to his purpose." --- Roman 8:28
Go to Top of Page
   

- Advertisement -