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 2008 Forums
 Other SQL Server 2008 Topics
 Append in SQL Server 2008

Author  Topic 

jcb267
Constraint Violating Yak Guru

291 Posts

Posted - 2009-01-25 : 09:36:41
I am trying to append the data that I have in a table called OMS_2 to a table called OMS_1.

Here is the query I am using:

INSERT INTO OMS_1 (From Service DATE, MaineCare ID, Provider Name, PRCDR CODE, Procedure Description,Modifier Code 1, Modifier Code 2, Modifier Code 3, Modifier Code 4, COS,Claims Pricing Ind#, Paid Service Units, Allowed Amount, Payment Amount, Period)
SELECT OMS_2.From Service DATE, OMS_2.MaineCare ID, OMS_2.Provider Name, OMS_2.PRCDR CODE, OMS_2.Procedure Description,
OMS_2.Modifier Code 1, OMS_2.Modifier Code 2, OMS_2.Modifier Code 3, OMS_2.Modifier Code 4, OMS_2.COS, OMS_2.Claims Pricing Ind#, OMS_2.Paid Service Units, OMS_2.Allowed Amount, OMS_2.Payment Amount, OMS_2.Period
FROM OMS_2

I know I have field names that are reserved sql keywords, how do I get around that? Can anyone help with the query?

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-01-25 : 10:01:41
Have a look at the new MERGE command.



E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page

jcb267
Constraint Violating Yak Guru

291 Posts

Posted - 2009-01-25 : 10:04:41
thanks
quote:
Originally posted by Peso

Have a look at the new MERGE command.



E 12°55'05.63"
N 56°04'39.26"


Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2009-01-25 : 11:25:05
If you are doing straight inserts, you can keep your insert statement.
Use brackets [ and ] for reserved words.


E 12°55'05.63"
N 56°04'39.26"
Go to Top of Page
   

- Advertisement -