SQL 拾遗
1. T-sql新增自增长列
1 SET NOCOUNT ON 2 3 DECLARE @id int,@filepath VARCHAR(100) 4 5 SET @id =1 6 7 DECLARE mycursor CURSOR FOR 8 9 SELECT filepath FROM filelist 10 11 OPEN mycursor 12 13 FETCH NEXT FROM mycursor 14 INTO @filepath 15 16 WHILE @@FETCH_STATUS = 0 17 18 BEGIN 19 UPDATE filelist 20 SET id = @id 21 WHERE filepath=@filepath 22 23 SET @id= @id + 1 24 25 FETCH NEXT FROM mycursor INTO @filepath 26 27 END 28 29 CLOSE mycursor 30 31 DEALLOCATE mycursor 32 33 GO
2.字符串转浮点
convert(float,@leftHours2))
来自杭州西溪。主打Linux系统架构、维优、项目外包