查询的时候 select right(10000+id,4) as id from tablename
Create Table TEST(ID Varchar(10)) Insert TEST Select 1 Union All Select 2 Union All Select 3 Union All Select 4 GO Update TEST Set ID = Right(10000 + ID, 4)Select * From TEST GO Drop Table TEST --Result /* ID 0001 0002 0003 0004 */
paoluo 在哪里写这段代码?谢谢
在查詢分析器中,選擇你要更新的表所在的數據庫。然後執行Update TEST Set ID = Right(10000 + ID, 4)
Update TEST Set ID = Right(10000 + ID, 4)就这个了哈,楼主执行吧
select right(10000+id,4) as id from tablename
Insert TEST Select 1
Union All Select 2
Union All Select 3
Union All Select 4
GO
Update TEST Set ID = Right(10000 + ID, 4)Select * From TEST
GO
Drop Table TEST
--Result
/*
ID
0001
0002
0003
0004
*/
在哪里写这段代码?谢谢