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.
Author |
Topic |
gaby_58
Starting Member
33 Posts |
Posted - 2013-11-13 : 11:09:28
|
Hi all, I have this Insert statement in Access, need to write the same in SQL Server, how to write this?INSERT INTO Load ( LocationNumber, LocationNumber2, LocationId, PermitLocation, FilingLocation, ReportingId, DistrictId, StatusIdSELECT Original.MAST_ID, Original.WELL_ID, 0 AS expr1, [State_Name] & " " & [County_SL] AS Permit, [Oper_State] & " " & [Oper_City] AS Filing, 1 AS expr2, 0 AS expr3, 1 AS StatusIdFROM OriginalWHERE (((Original.NEW_WELL)=True))AND ((Original.RecdDate)=#10/25/2013#));Thanks for any support |
|
sanjnep
Posting Yak Master
191 Posts |
Posted - 2013-11-13 : 12:39:12
|
INSERT INTO Load (LocationNumber, LocationNumber2, LocationId, PermitLocation, FilingLocation, ReportingId, DistrictId, StatusId)SELECT Original.MAST_ID, Original.WELL_ID, 0 AS expr1, [State_Name] + ' '+ [County_SL] AS Permit, [Oper_State] + ' '+ [Oper_City] AS Filing, 1 AS expr2, 0 AS expr3, 1 AS StatusIdFROM OriginalWHERE Original.NEW_WELL = 'True' AND Original.RecdDate ='10/25/2013' |
|
|
gaby_58
Starting Member
33 Posts |
Posted - 2013-11-13 : 14:15:14
|
Thank you somuch, it worked.. |
|
|
gaby_58
Starting Member
33 Posts |
Posted - 2013-11-15 : 11:08:52
|
Would like to know if I have more where conditions like Original.Work = 'OD' or 'OD/LT' or 'OD/ST' along with Original.RecdDate, how to keep this in one sentence.Thank You for your help. |
|
|
djj55
Constraint Violating Yak Guru
352 Posts |
Posted - 2013-11-15 : 12:15:13
|
Original.Work IN ('OD','OD/LT','OD/ST')djj |
|
|
gaby_58
Starting Member
33 Posts |
Posted - 2013-11-15 : 13:50:41
|
Thank You . |
|
|
|
|
|
|
|