1 time1 A 30 to 1%
2 time2 B 31 2%
3 time3 C 32 3%
4 time4 D 33 4%
5 time5 E 34 5%
6 time6 F 35 6%
Find time2 and replace pressure, humidity, converted into 1
2 time2 1 1 1
CodePudding user response:
USE tempdb for
GO
IF OBJECT_ID (' dbo. [t]) IS NOT NULL
DROP TABLE dbo. [t]
GO
The CREATE TABLE dbo. [t] (
[ID] NVARCHAR (MAX)
[time] NVARCHAR (MAX)
, [pressure] NVARCHAR (MAX)
, the moisture content of the [] NVARCHAR (MAX)
The translation], [NVARCHAR (MAX)
)
GO
SET NOCOUNT ON
INSERT INTO dbo. [t] VALUES (N '1', N 'time1', N 'A', N '30', N '1%')
INSERT INTO dbo. [t] VALUES (' 2 'N, N' time2 ', N 'B', N 'and' N '2%')
INSERT INTO dbo. [t] VALUES (' 3 'N, N' time3 ', N 'C', N '32', N '3%')
INSERT INTO dbo. [t] VALUES (' 4 'N, N' time4 ', 'D' N, N '33', N '4%')
INSERT INTO dbo. [t] VALUES (N '5', N 'time5', N 'E', N '34', N '5%')
INSERT INTO dbo. [t] VALUES (N '6', N 'time6', N 'F', N '35', N '6%')
-- -- -- -- -- -- -- -- -- -- -- -- above for testing table and test data -- -- -- -- -- -- -- -- -- -- -- -- -- --
The UPDATE t
The SET pressure='1',
Humidity='1',
Convert='1'
WHERE time='time2'
SELECT * FROM t
/*
ID time pressure humidity conversion
1 time1 A 30 to 1%
2 time2 1 1 1
3 time3 C 32 3%
4 time4 D 33 4%
5 time5 E 34 5%
6 time6 F 35 6%
*/
CodePudding user response:
Thank you very much, has been testing, are available