February 21, 2006 at 10:23 pm
Hi all,
Can any one help me to solve the following issue.
I ran the following script.after complete execution of the script it is displaying the result in grid and as well as it is displaying some warnings....observe the follwoing script
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET ANSI_WARNINGS ON
GO
IF EXISTS (SELECT * FROM DBO.SYSOBJECTS WHERE ID = OBJECT_ID('[DBO].[processed_olap_data_1]') AND OBJECTPROPERTY(ID, N'ISUSERTABLE') = 1)
DROP TABLE [DBO].[processed_olap_data_1]
select * into dbo.processed_olap_data_1 from pubs.dbo.processed_olap_data_1
EXEC ('ALTER TABLE dbo.processed_olap_data_1 ADD generatedid INT IDENTITY')
select * from processed_olap_data_1 order by generatedid
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS OFF
GO
SET ANSI_WARNINGS OFF
GO
and one more thing is that i want to use this code in one sp and the columns are inserted in to table dynomically.
Thanks,
Rao Aregaddan.
February 24, 2006 at 8:00 am
This was removed by the editor as SPAM
February 24, 2006 at 8:37 am
quote: as well as it is displaying some warnings
What warnings are you getting?
-SQLBill
February 24, 2006 at 8:43 am
SELECT INTO creates a NEW table, but you have to give it a table name. You are using the SAME table name, so that won't work.
Let's step through this:
DROP TABLE [DBO].[processed_olap_data_1]
--you just dropped table processed_olap_data_1 and it no longer exists.
select * into dbo.processed_olap_data_1 from pubs.dbo.processed_olap_data_1
--now you try to select from the table you just dropped.
EXEC ('ALTER TABLE dbo.processed_olap_data_1 ADD generatedid INT IDENTITY')
What are you trying to do?
-SQLBill
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply