定义一个存储过程如下: create proc [dbo].[test1] @id int as select 1 as id,'abc' as name union all select @id as id,'zzz' as name 返回两行数据.现在想用SQL语句来调用这个存储过程,并把他返回的表放入变量中.可以如下做: declare @table table(id int,name varchar(50))--定义表变量来存放存储过程返回的内容 insert into @table e…
怎样用SQL语句查询一个数据库中的所有表? --读取库中的所有表名 select name from sysobjects where xtype='u'--读取指定表的所有列名select name from syscolumns where id=(select max(id) from sysobjects where xtype='u' and name='表名')获取数据库表名和字段sqlserver中各个系统表的作用sysaltfiles 主数据库 保存数据库的文件syschars…