September 14, 2012 at 10:46 am
I have 2 tables that are identical. I wish to copy some records from one table to the other with the following script.
INSERT INTO RH2007_EvyLive.dbo.RETAIL_SALES
SELECT *
FROM Jay.dbo.RETAIL_SALES
WHERE CUST_NO='MACY01'
When I execute it I get the message "(2810 row(s) affected)" and "Query executed successfully". When I query RH2007_EvyLive.dbo.RETAIL_SALES, the records are not there.
Any help would be appreciated.
Jay
SQL Server 2008 R2 standard
September 14, 2012 at 11:19 am
Any triggers on the destination table?
September 14, 2012 at 11:26 am
I don't believe there is a trigger. How can I find out for sure?
September 14, 2012 at 11:32 am
Look?
September 14, 2012 at 11:52 am
I appreciate your time to help me with this challenge. Please be patient since I am a rookie. I have never intentially created a trigger since I honestly do not know it's purpose. Using SSMS there were no triggers under "Database Triggers".
September 14, 2012 at 12:25 pm
Check this image to know where to find the triggers.
Use the appropriate table.
September 14, 2012 at 12:29 pm
Thanks Luis. No triggers.
September 14, 2012 at 3:14 pm
JayWinter (9/14/2012)
I have 2 tables that are identical. I wish to copy some records from one table to the other with the following script.INSERT INTO RH2007_EvyLive.dbo.RETAIL_SALES
SELECT *
FROM Jay.dbo.RETAIL_SALES
WHERE CUST_NO='MACY01'
When I execute it I get the message "(2810 row(s) affected)" and "Query executed successfully". When I query RH2007_EvyLive.dbo.RETAIL_SALES, the records are not there.
Any help would be appreciated.
Jay
SQL Server 2008 R2 standard
I know this will sound like a stupid question but, as you said, you're new to SQL and I have to ask because of that.
How do you know the rows weren't actually inserted? What code did you use to make that determination?
--Jeff Moden
Change is inevitable... Change for the better is not.
September 14, 2012 at 3:23 pm
Good question Jeff.
I let SSMS generate the code to print the TOP 1000 records. There are over 100 columns in the table so here is the code after removing most. I added the WHERE clause.
/****** Script for SelectTopNRows command from SSMS ******/
SELECT TOP 1000 [CUST_NO]
,[YR]
,[MO]
,[WK]
,[SEQ_ID]
FROM [Evy_RH_Objects].[dbo].[RETAIL_SALES]
WHERE [CUST_NO]='MACY01'
September 14, 2012 at 3:26 pm
I just noticed I queried a different table. It worked. Thank you all.
September 15, 2012 at 12:36 am
I like the way Jeff determined to identify the issue 🙂
Viewing 11 posts - 1 through 10 (of 10 total)
You must be logged in to reply to this topic. Login to reply