Ms sql 2000 動態組合條件

2021-04-25 02:54:53 字數 769 閱讀 5738

select 

a.id, a.typename, a.code,

a.content, a.buildin, a.parentid, b.content categorydisplayname,

b.buildin categorybuildin, b.reftablename

from code a    

left join code b on(a.typename = b.code and b.typename = #39codeca + tegoryname#39)

where

((@typename is null) or (a.typename = @typename))

and ((@content is null ) or (a.content = @content))

and ((@code is null) or (a.code = @code))

and ((@buildin is null) or (a.buildin = @buildin))

and ((@id is null) or (a.[id] = @id))

and ((@categorybuildin is null) or (b.buildin = @categorybuildi + n))

and ((@parentid is null) or (a.parentid = @parentid))

)這段**能在sql server 2000 上跑

如果引數為空,那麼對因的where 條件不起作用

MSSQL2000資料型別

長度 定長變長 變長時該長度為最大長度 定長時該長度一定要滿足該長度的大小。字元型別中的var是變長的 字元 位元組 統一編碼用雙位元組結構來儲存每個字元,而不是用單位元組 普通文字中的情況 sql字元類的資料型別中有個n開頭的型別是統一編碼的 mssql中要指定長度的資料型別有char,varch...

按照姓名分組 MS SQL2000

declare t table name varchar 20 insert into t select 全曉輝 union all select 全市的 union all select 第三代 union all select 撒地方 union all select 撒旦 select max...

linux下連線mssql2000的配置

1.freetds freetds stable.tgz root yezi 2 tar xzvf freetds stable.tgz root yezi 2 tar xzvf freetds stable.tgz c toos 也可以加 c 制定釋放到哪個目錄 root yezi 2 cd fr...