前一段時(shí)間由于碰到兩個(gè)數(shù)據(jù)庫(kù)的數(shù)據(jù)轉(zhuǎn)移!
所以加深了對(duì)SQL的一個(gè)字符操作函數(shù)的了解,NTEXT,TEXT,IMAGE這些數(shù)據(jù)類(lèi)型都不能使用一些通用的操作函數(shù)如left,right,trim 等
由于我要轉(zhuǎn)移的數(shù)據(jù)的表有的使用了ntext的數(shù)據(jù)
在這個(gè)字段里有一些數(shù)據(jù)要更新!
所以用腳本語(yǔ)言asp來(lái)做一個(gè)中轉(zhuǎn)!
我想說(shuō)的是有這種情況最好要用腳本做一個(gè)中轉(zhuǎn)
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
CREATE PROC SORT
@NEW VARCHAR(8),
@OLD varchar(8)
as
declare my_cursor cursor dynamic /*scroll表示可隨意移動(dòng)游標(biāo)指針(否則只能向前),dynamic表示可以讀寫(xiě)游標(biāo)(否則游標(biāo)只讀)*/
for
select ecomsql.dbo.comwenzhanglei.id,ecomsql.dbo.comwenzhanglei.lei,ecomsql.dbo.comwenzhanglei.connect from ecomsql.dbo.comwenzhanglei where
ecomsql.dbo.comwenzhanglei.comid=@newopen my_cursor
declare @name char(100),@tempid int,@conn int
fetch next from my_cursor into @tempid,@name,@conn
end
--fetch first from my_cursor into @name
close my_cursor
deallocate my_cursor
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO