Benny:只处理那些NVARCHAR字段,并且NTEXT也是小于4000个字符时的情况.不管类型.只管长度.
/*
Benny:只处理那些NVARCHAR字段,并且NTEXT也是小于4000个字符时的情况.不管类型.只管长度.
*/
------------------------------------------------------ NTEXT FIELDS ------------------------------------------------------------------------
DECLARE @val BINARY(16)
SELECT @val=TEXTPTR([Content]) FROM [4wdcc_20080131_20080325_152152_ForBennyTesting].dbo.[ta_news]
WHERE 1=1
--AND LEN(CAST ([Content] AS NVARCHAR(4000) )) >=4000
AND [Id] IN (100000000795)
ORDER BY [Id]
PRINT @val
WRITETEXT [ta_news].[Content] @val N'new abc'
(
SELECT [Content] FROM [4wdcc_20080131_20080325_152152_ForBennyTesting].dbo.[ta_news] WHERE [Id] IN (100000000804)
)
UPDATETEXT [ta_news].[Content] @val NULL NULL (
SELECT [Content] FROM [4wdcc_20080131_20080325_152152_ForBennyTesting].dbo.[ta_news] WHERE [Id] IN (100000000804)
)
--UPDATETEXT [ta_news].[Content] WHERE id=100000000274
SELECT * FROM [ta_news] WHERE [Content] LIKE '%leods%' ORDER BY [Id]
SELECT * FROM [4wdcc_20080131_20080325_152152_ForBennyTesting].dbo.[ta_news] WHERE id IN (100000000816) ORDER BY [Id]
SELECT * FROM [ta_news] WHERE [Table_Code] LIKE '%what%'
SELECT * FROM [ta_news] WHERE LEN(CAST ([Content] AS NVARCHAR(4000) )) >=4000
AND DATEPART(yy,[Modified_At])=2008 AND DATEPART(mm,[Modified_At])>=3
ORDER BY [Modified_At] DESC
SELECT * FROM [ta_news] WHERE DATEPART(yy,[Modified_At])=2008 AND DATEPART(mm,[Modified_At])>3 AND LEN(CAST ([Content] AS NVARCHAR(4000) )) >=4000 ORDER BY [Id]
SELECT * FROM [ta_news] WHERE [Content] LIKE '%要更替的内容%' ORDER BY [Id]
SELECT * FROM [ta_news] WHERE LEN(CAST ([Content] AS NVARCHAR(4000) )) <4000 AND [Id] IN (100000000804) ORDER BY [Id]
SELECT * FROM [ta_news] WHERE [Content] LIKE '%要更替的内容%' ORDER BY [Id]
--[ta_news] nText
SELECT * FROM [ta_news] WHERE LEN(CAST ([Content] AS NVARCHAR(4000) )) <4000
UPDATE [ta_news]
set [Content]=replace(cast([Content] as nvarchar(4000)),'要更替的内容','')
WHERE LEN(CAST ([Content] AS NVARCHAR(4000) )) <4000
DECLARE @val BINARY(16)
SELECT @val=TEXTPTR(Product_Description) FROM [4wdcc_20080131_20080325_152152_ForBennyTesting].dbo.product_ta_product
WHERE 1=1
--AND LEN(CAST ([Content] AS NVARCHAR(4000) )) >=4000
AND [Id] IN (100000000319)
ORDER BY [Id]
PRINT @val
WRITETEXT product_ta_product.Product_Description @val N'新內容'
SELECT * FROM product_ta_product WHERE Product_Description LIKE '%leods%' ORDER BY [Id]
SELECT * FROM [4wdcc_20080131_20080325_152152_ForBennyTesting].dbo.product_ta_product WHERE id IN (100000000319) ORDER BY [Id]
SELECT * FROM product_ta_product WHERE LEN(CAST (Product_Description AS NVARCHAR(4000) )) >=4000
AND DATEPART(yy,[Modified_At])=2008 AND DATEPART(mm,[Modified_At])>=3
ORDER BY [Modified_At] DESC
SELECT * FROM product_ta_product WHERE LEN(CAST (Product_Description AS NVARCHAR(4000) )) >=4000 ORDER BY [Id]
SELECT * FROM product_ta_product WHERE LEN(CAST (Product_Description AS NVARCHAR(4000) )) <4000 ORDER BY [Id]
SELECT * FROM product_ta_product WHERE Product_Description LIKE '%要更替的内容%'
--product_ta_product nText
SELECT * FROM product_ta_product WHERE LEN(CAST (Product_Description AS NVARCHAR(4000) )) <4000
UPDATE product_ta_product
set Product_Description=replace(cast(Product_Description as nvarchar(4000)),'要更替的内容','')
WHERE LEN(CAST (Product_Description AS NVARCHAR(4000) )) <4000
DECLARE @val BINARY(16)
SELECT @val=TEXTPTR(Product_Description) FROM [4wdcc_20080131_20080325_152152_ForBennyTesting].dbo.product_ta_newproduct
WHERE 1=1
--AND LEN(CAST ([Content] AS NVARCHAR(4000) )) >=4000
AND [Id] IN (100000000407)
ORDER BY [Id]
PRINT @val
WRITETEXT product_ta_newproduct.Product_Description @val N'要寫下來的內容(這個才是要更新的內容,很奇怪的語法)'
SELECT * FROM product_ta_newproduct WHERE Product_Description LIKE '%leods%' ORDER BY [Id]
SELECT * FROM [4wdcc_20080131_20080325_152152_ForBennyTesting].dbo.product_ta_newproduct WHERE id IN (100000000600) ORDER BY [Id]
SELECT * FROM product_ta_newproduct WHERE LEN(CAST (Product_Description AS NVARCHAR(4000) )) >=4000
AND DATEPART(yy,[Modified_At])=2008 AND DATEPART(mm,[Modified_At])>=3
ORDER BY [Modified_At] DESC
SELECT * FROM product_ta_newproduct WHERE LEN(CAST (Product_Description AS NVARCHAR(4000) )) >=4000 ORDER BY [Id]
SELECT * FROM product_ta_newproduct WHERE LEN(CAST (Product_Description AS NVARCHAR(4000) )) <4000 ORDER BY [Id]
SELECT * FROM product_ta_newproduct WHERE Product_Description LIKE '%要更替的内容%'
--product_ta_newproduct nText
SELECT * FROM product_ta_newproduct WHERE LEN(CAST (Product_Description AS NVARCHAR(4000) )) <4000
----------------------------------------------- TEXT FIELDS -----------------------------------------------------------------------------------
--[client_ts_currency]
SELECT * FROM [client_ts_currency]
UPDATE [client_ts_currency]
set [Currency_Name]=replace(cast([Currency_Name] as nvarchar(4000)),'要更替的内容','')
--likeyou_ts_department
SELECT * FROM likeyou_ts_department
UPDATE likeyou_ts_department
set Department=replace(cast(Department as nvarchar(4000)),'要更替的内容','')
--likeyou_ts_group
SELECT * FROM likeyou_ts_group
UPDATE likeyou_ts_group
set [Group_Name]=replace(cast([Group_Name] as nvarchar(4000)),'要更替的内容','')
--likeyou_ts_user
SELECT * FROM likeyou_ts_user
UPDATE likeyou_ts_user
set [User_Account]=replace(cast([User_Account] as nvarchar(4000)),'要更替的内容','')
,[User_Password]=replace(cast([User_Password] as nvarchar(4000)),'要更替的内容','')
,[User_Question]=replace(cast([User_Question] as nvarchar(4000)),'要更替的内容','')
,[User_Answer]=replace(cast([User_Answer] as nvarchar(4000)),'要更替的内容','')
,[User_Name]=replace(cast([User_Name] as nvarchar(4000)),'要更替的内容','')
,[User_Title]=replace(cast([User_Title] as nvarchar(4000)),'要更替的内容','')
,[User_Mobile]=replace(cast([User_Mobile] as nvarchar(4000)),'要更替的内容','')
,[User_Phone]=replace(cast([User_Phone] as nvarchar(4000)),'要更替的内容','')
,[User_Email]=replace(cast([User_Email] as nvarchar(4000)),'要更替的内容','')
,[User_Educational_BackGround]=replace(cast([User_Educational_BackGround] as nvarchar(4000)),'要更替的内容','')
,[User_Graduation_School]=replace(cast([User_Graduation_School] as nvarchar(4000)),'要更替的内容','')
,[User_Intro]=replace(cast([User_Intro] as nvarchar(4000)),'要更替的内容','')
,[Application_Language]=replace(cast([Application_Language] as nvarchar(4000)),'要更替的内容','')
--product_ta_newproduct
SELECT * FROM product_ta_newproduct
UPDATE product_ta_newproduct
set [Table_Code]=replace(cast([Table_Code] as nvarchar(4000)),'要更替的内容','')
,[Field_Code]=replace(cast([Field_Code] as nvarchar(4000)),'要更替的内容','')
,[Product_Name]=replace(cast([Product_Name] as nvarchar(4000)),'要更替的内容','')
,[Serial_No]=replace(cast([Serial_No] as nvarchar(4000)),'要更替的内容','')
,[Specification]=replace(cast([Specification] as nvarchar(4000)),'要更替的内容','')
--product_ta_product
SELECT * FROM product_ta_product
UPDATE product_ta_product
set [Table_Code]=replace(cast([Table_Code] as nvarchar(4000)),'要更替的内容','')
,[Field_Code]=replace(cast([Field_Code] as nvarchar(4000)),'要更替的内容','')
,[Product_Name]=replace(cast([Product_Name] as nvarchar(4000)),'要更替的内容','')
,[Serial_No]=replace(cast([Serial_No] as nvarchar(4000)),'要更替的内容','')
,[Specification]=replace(cast([Specification] as nvarchar(4000)),'要更替的内容','')
--product_ts_class
SELECT * FROM product_ts_class
UPDATE product_ts_class
set [Product_Class]=replace(cast([Product_Class] as nvarchar(4000)),'要更替的内容','')
,[Table_Code]=replace(cast([Table_Code] as nvarchar(4000)),'要更替的内容','')
,[Field_Code]=replace(cast([Field_Code] as nvarchar(4000)),'要更替的内容','')
,[Sorting]=replace(cast([Sorting] as nvarchar(4000)),'要更替的内容','')
--product_ts_group
SELECT * FROM product_ts_group
UPDATE product_ts_group
set [Product_Group]=replace(cast([Product_Group] as nvarchar(4000)),'要更替的内容','')
,[Table_Code]=replace(cast([Table_Code] as nvarchar(4000)),'要更替的内容','')
,[Field_Code]=replace(cast([Field_Code] as nvarchar(4000)),'要更替的内容','')
,[Sorting]=replace(cast([Sorting] as nvarchar(4000)),'要更替的内容','')
--product_ts_set
SELECT * FROM product_ts_set
UPDATE product_ts_set
set [Product_Set]=replace(cast([Product_Set] as nvarchar(4000)),'要更替的内容','')
--product_ts_subclass
SELECT * FROM product_ts_subclass
UPDATE product_ts_subclass
set [SubClass]=replace(cast([SubClass] as nvarchar(4000)),'要更替的内容','')
,[Sorting]=replace(cast([Sorting] as nvarchar(4000)),'要更替的内容','')
--ta_document
SELECT * FROM ta_document
UPDATE ta_document
set
[Table_Code]=replace(cast([Table_Code] as nvarchar(4000)),'要更替的内容','')
,[Field_Code]=replace(cast([Field_Code] as nvarchar(4000)),'要更替的内容','')
,[File_Name]=replace(cast([File_Name] as nvarchar(4000)),'要更替的内容','')
,[File_Name_After_Uploaded]=replace(cast([File_Name_After_Uploaded] as nvarchar(4000)),'要更替的内容','')
,[File_Size]=replace(cast([File_Size] as nvarchar(4000)),'要更替的内容','')
,[Content_Type]=replace(cast([Content_Type] as nvarchar(4000)),'要更替的内容','')
,[UrlPath]=replace(cast([UrlPath] as nvarchar(4000)),'要更替的内容','')
,[ActualPath]=replace(cast([ActualPath] as nvarchar(4000)),'要更替的内容','')
--ta_news
SELECT * FROM ta_news
UPDATE ta_news
set
[Title]=replace(cast([Title] as nvarchar(4000)),'要更替的内容','')
,[Table_Code]=replace(cast([Table_Code] as nvarchar(4000)),'要更替的内容','')
,[Field_Code]=replace(cast([Field_Code] as nvarchar(4000)),'要更替的内容','')
--ta_news
SELECT * FROM ts_id
UPDATE ts_id
set
[tbl_name]=replace(cast([tbl_name] as nvarchar(4000)),'要更替的内容','')
--ts_ml
SELECT * FROM ts_ml
UPDATE ts_ml
set
[ml_code]=replace(cast([ml_code] as nvarchar(4000)),'要更替的内容','')
,[ml_chs]=replace(cast([ml_chs] as nvarchar(4000)),'要更替的内容','')
,[ml_cht]=replace(cast([ml_cht] as nvarchar(4000)),'要更替的内容','')
,[ml_eng]=replace(cast([ml_eng] as nvarchar(4000)),'要更替的内容','')
--ts_right
SELECT * FROM ts_right
UPDATE ts_right
set
[Application_Code]=replace(cast([Application_Code] as nvarchar(4000)),'要更替的内容','')
,[Application_Premission]=replace(cast([Application_Premission] as nvarchar(4000)),'要更替的内容','')
,[Application_Value]=replace(cast([Application_Value] as nvarchar(4000)),'要更替的内容','')
--ts_role
SELECT * FROM ts_role
UPDATE ts_role
set
[Role]=replace(cast([Role] as nvarchar(4000)),'要更替的内容','')
--ts_status
SELECT * FROM ts_status
UPDATE ts_status
set
[Table_Code]=replace(cast([Table_Code] as nvarchar(4000)),'要更替的内容','')
,[Field_Code]=replace(cast([Field_Code] as nvarchar(4000)),'要更替的内容','')