Showing posts with label exec. Show all posts
Showing posts with label exec. Show all posts

Friday, March 30, 2012

how to rename a temp table

EXEC sp_rename '#customers', '#custs'
result with error :Invalid object name '#customers'.
how to rename a temp table?Sam
sp_rename
Changes the name of a user-created object (for example, table, column, or
user-defined data type) in the current database.
"Sam" <focus10@.zahav.net.il> wrote in message
news:ecE3BxurFHA.2008@.TK2MSFTNGP10.phx.gbl...
> EXEC sp_rename '#customers', '#custs'
> result with error :Invalid object name '#customers'.
> how to rename a temp table?
>
>|||Sam wrote:
> EXEC sp_rename '#customers', '#custs'
> result with error :Invalid object name '#customers'.
> how to rename a temp table?
I'm not sure you can rename a temporary table. Why do you need to do
this?
David Gugick
Quest Software
www.imceda.com
www.quest.com|||so how can i rename the temp table?
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:OziOz4urFHA.240@.tk2msftngp13.phx.gbl...
> Sam
> sp_rename
> Changes the name of a user-created object (for example, table, column, or
> user-defined data type) in the current database.
>
>
>
> "Sam" <focus10@.zahav.net.il> wrote in message
> news:ecE3BxurFHA.2008@.TK2MSFTNGP10.phx.gbl...
>|||I don't think there's a documented way to do it.
Why would you ever want to rename a temp table? This seems especially
pointless with a local temp table, which after all is intended
precisely to give you a locally-scoped name for the table. I'm sure if
you explain your requirement we can suggest a better solution to avoid
doing this.
David Portas
SQL Server MVP
--|||Uri, I believe sp_rename disallows renaming temp objects.
Hope this helps.
Dan Guzman
SQL Server MVP
"Uri Dimant" <urid@.iscar.co.il> wrote in message
news:OziOz4urFHA.240@.tk2msftngp13.phx.gbl...
> Sam
> sp_rename
> Changes the name of a user-created object (for example, table, column, or
> user-defined data type) in the current database.
>
>
>
> "Sam" <focus10@.zahav.net.il> wrote in message
> news:ecE3BxurFHA.2008@.TK2MSFTNGP10.phx.gbl...
>|||select * into #NewName from #OldName
drop table #OldName
--Brian
(Please reply to the newsgroups only.)
"Sam" <focus10@.zahav.net.il> wrote in message
news:uBSEB%23urFHA.1168@.TK2MSFTNGP11.phx.gbl...
> so how can i rename the temp table?
>
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:OziOz4urFHA.240@.tk2msftngp13.phx.gbl...
>|||sp_rename renames the table in the current database. a temp table is created
in tempdb database and tempdb doesnt have sp_rename stored procedure.
the table gets deleted immediately after the session is closed, so why do u
want to
rename it
best Regards,
Chandra
http://chanduas.blogspot.com/
http://www.SQLResource.com/
---
"Sam" wrote:

> EXEC sp_rename '#customers', '#custs'
> result with error :Invalid object name '#customers'.
> how to rename a temp table?
>
>
>|||Hi, Dan
That was exactly may point.
"Dan Guzman" <guzmanda@.nospam-online.sbcglobal.net> wrote in message
news:OpFv7%23urFHA.2540@.TK2MSFTNGP09.phx.gbl...
> Uri, I believe sp_rename disallows renaming temp objects.
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> "Uri Dimant" <urid@.iscar.co.il> wrote in message
> news:OziOz4urFHA.240@.tk2msftngp13.phx.gbl...
>|||> how to rename a temp table?
What would be the point?

How to rename a column in SqlCE?

When I execute EXEC sp_rename 'PATHSPECIMEN.PVVALUE', 'PVPROC', 'COLUMN', I am getting the following error:
Major Error 0x80004005, Minor Error 25621
> EXEC sp_rename 'PATHSPECIMEN.PVVALUE', 'PVPROC', 'COLUMN'
The specified argument value for the procedure is not valid. [ Argument # = 3,Name of procedure(if known) = sp_rename ]

Could some one guide me where I am wrong?
I am executing this query against SqlCE in Sql Server 2005 Management Studio.

The sp_rename procedure is not avialable in SQL CE!

In Sql Server 2005 Management Studio you have to create a new column with the new name, then you have to update it with the values from your old column and then you have to delete your old column. The last action is difficult if the column is (part of) an index.

ALTER TABLE YOURTABLENAME ADD PVPROC INTEGER (or your datatype)
UPDATE YOURTABLENAME SET PVPROC = PATHSPECIMEN.PVVALUE
ALTER TABLE School DROP COLUMN PATHSPECIMEN.PVVALUE

I did it yesterday myself in this way!

Anne-Jan Tuinstra

|||Hi,

Thanks for your prompt reply and for the nice solution.

As you said that column is a part of index, how to go to resolve this case?.

Thanks
GSR|||

I think you/ I have to remove the index.

Up till now it didn't work with the manager.

My table now has one column to many!!!!!

Monday, March 26, 2012

How to Reintialize A Single Article!

Hello All,
I'm using Transactional Replication and it's Push subscription.
I want to Reintialize 1 article, i did this,
exec sp_reinitsubscription
@.publication = 'inventory',
@.article = 'customer',
@.for_schema_change = 1,
@.subscriber = 'subscriber'
but error
"Cannot reinitialize article 'customer' in subscription
'Subscriber:Inventory' to publication 'inventory' (subscribed with the 'no
sync' option)."
How can I Reintialize A Single Article?
Thanks in advance!!!
Naveed.
you can't. You are best to drop the article from the publication, and create
another publication with this article in it by itself.
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
"Naveed" <nrehman@.marsonssoft.com> wrote in message
news:ud8A0l5qEHA.2724@.TK2MSFTNGP14.phx.gbl...
> Hello All,
> I'm using Transactional Replication and it's Push subscription.
> I want to Reintialize 1 article, i did this,
> exec sp_reinitsubscription
> @.publication = 'inventory',
> @.article = 'customer',
> @.for_schema_change = 1,
> @.subscriber = 'subscriber'
> but error
> "Cannot reinitialize article 'customer' in subscription
> 'Subscriber:Inventory' to publication 'inventory' (subscribed with the
'no
> sync' option)."
> How can I Reintialize A Single Article?
> Thanks in advance!!!
> Naveed.
>
|||In article <#3hYFP6qEHA.2796
@.TK2MSFTNGP10.phx.gbl>, hilary.cotter@.gmail.com
says...
> you can't. You are best to drop the article from the publication, and create
> another publication with this article in it by itself.
>
can you drop just an article from a publication
or do you have to drop the whole publication
itself? I have run into this situation before
where I had 5 pretty large articles in 1
publication and needed to drop just 1 of those
articles. I couldn't just do that. I had to
drop the whole pub.
-comb