EDIT to read first:I had a missmatch within my query, now I tried this one:SELECT Id, Tag, CompanyId, DepartmentId FROM InstrumentWHERE Tag IN ( '102-1-WSTATION1-ANEMOM','102-1-WSTATION1-BAROMETER','102-1-WSTATION1-HUMIDITY','102-1-WSTATION1-RAIN','102-1-WSTATION2-ANEMOM','102-1-WSTATION2-HUMIDITY','102-1-WSTATION2-RAIN');UPDATE Instrument SET Tag = '20-O-WSTATION1-ANEMOM', CompanyId = '63', DepartmentId = '76' WHERE Id = '1578'
I could identify all needed Ids thie first result is fine. But I couldn´t find the right query to update all TAG in one step, only for each single ;)Hi Tara!!!Thanks for the script I will test it asap. I added a new Building name (20)(type=varchar) within Table Company and I got back the int data type as an increment ID from SQL = 63.I also added within table Department a cost center number as varchar and I got back an int ID = 76.Now I have to replace several TAG data like "102-1-WSTATION1-ANEMOM" with "20-O-WSTATION1-ANEMOM" and has to be sure that this data linked to the Cost Center and Building name. Of course with the internal Database ID 63 and 76...I hope I make it a little bit clear for the moment?;)Please find attached the original data. The green highlighted are the new data. I add the cost center , building and at the end I have to replace old Tag to the new one and need the connection to new building and Cost Center. But I have update it with the internal SQL ID as I described it before or?!![URL=http://www.directupload.net]IMG]http://s7.directupload.net/images/140613/cfua4hdg.png[/IMG][/URL]EDIT: unfortunately it didn´t work yet..I made three querys as precondition for the last one above. Now I am a little bit confused
This one ist fine:SELECT Id, Name, LanguageFROM CompanyINSERT INTO Company (Name, Language)VALUES ('20', 'en-GB')
and also this one:Select * from Department Insert into Department (Name, CompanyId) Values ('1-3000-19420' , 63);