日期:2014-05-18 浏览次数:20622 次
if object_id('ChuShiHua') is not null Drop procedure ChuShiHua Create procedure ChuShiHua as begin if Object_ID('SK_Silk') is not null Drop table SK_Silk Create Table SK_Silk ( silk_own int, cardID varchar(50), cStatus varchar(50) ) go Insert into SK_Silk Select 11,'aaa','b' union Select 7,'a1a','1' union Select 14,'3aa','5' union Select 55,'a5','6' go if Object_ID('_OnOffline') is not null Drop table _OnOffline Create Table _OnOffline ( silk_own int, cardID varchar(50), cStatus varchar(50) ) go Insert into _OnOffline Select 14,'aaa','b' union Select 7,'at','1' union Select 11,'3ya','5' union Select 7,'a77','6' go if Object_ID('_User') is not null Drop table _User Create Table _User ( silk_own int, cardID varchar(50), cStatus varchar(50) ) go Insert into _User Select 14,'a0a','b' union Select 9,'at','1' union Select 11,'3ya','5' union Select 12,'a77','6' go sp_rename '[SK_Silk].cardID','charId','COLUMN' go sp_rename '[_OnOffline].cardID','charId','COLUMN' go sp_rename '[_User].cardID','charId','COLUMN' go Select * from SK_Silk Select * from _OnOffline Select * from _User go end go
sp_helptext ChuShiHua go
if object_id('ChuShiHua') is not null Drop procedure ChuShiHua GO Create procedure ChuShiHua as begin if Object_ID('SK_Silk') is not null Drop table SK_Silk Create Table SK_Silk ( silk_own int, cardID varchar(50), cStatus varchar(50) ) Insert into SK_Silk Select 11,'aaa','b' union Select 7,'a1a','1' union Select 14,'3aa','5' union Select 55,'a5','6' if Object_ID('_OnOffline') is not null Drop table _OnOffline Create Table _OnOffline ( silk_own int, cardID varchar(50), cStatus varchar(50) ) Insert into _OnOffline Select 14,'aaa','b' union Select 7,'at','1' union Select 11,'3ya','5' union Select 7,'a77','6' if Object_ID('_User') is not null Drop table _User Create Table _User ( silk_own int, cardID varchar(50), cStatus varchar(50) ) Insert into _User Select 14,'a0a','b' union Select 9,'at','1' union Select 11,'3ya','5' union Select 12,'a77','6' sp_rename '[SK_Silk].cardID