首頁 >資料庫 >mysql教程 >获得MSSQL表中的所有列字段名称的方法(存储过程)

获得MSSQL表中的所有列字段名称的方法(存储过程)

WBOY
WBOY原創
2016-06-07 14:55:131317瀏覽

原文地址: http://www.haokaoshi.com/html/jsjdj/3j/sjk/fd/37567.html SQL Server Create Proc pAllColumnSql (@tableName varchar(50)) as Declare @Name Varchar(2000) set @Name =’’ select @Name =@Name + ’,’ + Cast([name] as Varchar) from sys

原文地址: http://www.haokaoshi.com/html/jsjdj/3j/sjk/fd/37567.html SQL Server
Create  Proc pAllColumnSql 
(@tableName varchar(50)) 
as 
    
Declare @Name Varchar(2000) 
set @Name =’’ 
select @Name =@Name + ’,’ + Cast([name] as Varchar) 
from syscolumns 
where id=object_id(@tableName) 
set @name = substring(@name,2,len(@name)-1) 
select @name
陳述:
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn