write在sqlserver中的使用

2021-06-27 00:20:07 字數 1074 閱讀 7336

我用乙個簡單的例子來說明一下:

--下面是乙個表:

declare @table table 

(id int

identity

(1,1),window nvarchar

(max))

insert

into @table

(window)

select

'aaaa1111'

union

all

select

'aaa111'

union

all

select

'aa11'

select

*from @table/*

id          window

----------- ----------

1           aaaa1111

2           aaa111

3           aa11 */

--假設我們要更新表的該字段的後一半變成dd

update @table

set

window.write(

'dd'

,len

(window)/2,

ceiling

(cast

(len

(window)

asfloat

)/2))

select

*from @table/*

id          window

----------- ----------

1           aaaadd

2           aaadd

3           aadd */

用write一次就可以更新出現我們要的結果,當然我們也可以用別的辦法。

這裡只是說明一下write的用法。

注意事項:

1、write是sql server2005和sql server2008中方可使用。

2、write更新的字段要是varchar(max) 或是narchar(max)的。

write在sqlserver中的使用 葉子

我用乙個簡單的例子來說明一下 下面是乙個表 declare table table id int identity 1,1 window nvarchar max insert into table window select aaaa1111 union allselect aaa111 unio...

檔案函式write

呼叫write函式向開啟檔案中寫資料。include ssize t write int fd,const void buf,size t nbyte 引數第乙個是fd,第二個是緩衝區,第三個是寫入的位元組。返回值 成功返回已經寫的位元組數,失敗返回 1。write錯誤的原因 1 磁碟已經寫滿,2 ...

在sqlserver中with nolock 詳解

在查詢語句中使用 nolock 和 readpast 處理乙個資料庫死鎖的異常時候,其中乙個建議就是使用 nolock 或者 readpast 有關 nolock 和 readpast的一些技術知識點 對於非銀行等嚴格要求事務的行業,搜尋記錄中出現或者不出現某條記錄,都是在可容忍範圍內,所以碰到死鎖...