sqlserver(零碎)

2016-09-28  本文已影响10人  成熟的青菜

<pre><code>

sqlserver<code> ALTER proc [yd_update_ACCOUNT]
(
@unit varchar(20),
@account varchar(20) ,
@content varchar(20),
@sjno varchar(20),
@billtype varchar(20),
@appby varchar(20),
@appby2 varchar(20),
@zpno varchar(20),
)
AS
begin tran tx
UPDATE b_account_plus set account=@account WHERE pzid in(SELECT id FROM b_account WHERE billno = @unit )
UPDATE b_account set content=@content,sjno=@sjno,billtype=@billtype, appby= @appby, appby2= @appby2,zpno=@zpno WHERE billno = @unit

commit tran tx
IF @@error <> 0
rollback tran tx

查询字段的长度

SELECT c.colid as 序号, o.name as 表名, c.name as 列名,
t.name as 类型, c.length as 长度, c.isnullable as 允许空,c.colstat as 自增长
FROM syscolumns c INNER JOIN sysobjects o ON o.id = c.id AND objectproperty(o.id, N'IsUserTable') = 1 AND
o.name <> 'dtproperties' INNER JOIN
systypes t ON t.xusertype = c.xusertype
where o.name='b_tyd'
order by o.name, c.colid
</pre></code>

上一篇下一篇

猜你喜欢

热点阅读