select
a.name as column_name,
b.name as date_type
from
syscolumns a
join
systypes b
on a.xusertype=b.xusertype
where a.id=object_id('ProductClass')
a.name as column_name,
b.name as date_type
from
syscolumns a
join
systypes b
on a.xusertype=b.xusertype
where a.id=object_id('ProductClass')
解决方案 »
- 跪求,查询的一条SQL语句!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- select top 0 * into table1 from table2 ,有没办法可以直接修改table2的属性后生成table1?
- 如何在自定义的函数中返回值呢?
- ============求这样的sql语句如何写?有点难度!
- veritas中的SQL数据库问题
- 局域网ping ip可以ping 计算机名就不行为什么?
- 求一个表的查询语句???
- 谁现在手头上有一个进销存。VB+SQL SERVER,并且主要是用于商场超市的.
- 我的MSSQL7.0 for NT 4.0启动不起来了。错误:错误号2140,发生NT内部错误。
- 紧急求助- erp/mrpii
- 请问Sql sever中如何才能实现Access中的交叉表查询急
- 触发器优化
ClassId ClassName ParentClassId
1 农产品类 0
2 水果类 1
3 芒果类 2
4 苹果类 2
5 早熟苹果 4
我要查询农产品类下的所有子类,得到的结果应该是:
2 水果类 1
3 芒果类 2
4 苹果类 2
5 早熟苹果 4
insert into os select 1,0,'体育用品'
insert into os select 2,0,'户外运动'
insert into os select 3,1,'篮球'
insert into os select 4,1,'足球'
insert into os select 5,2,'帐篷'
insert into os select 6,2,'登山鞋'
insert into os select 7,0,'男士用品'
insert into os select 8,7,'刮胡刀'
insert into os select 9,3,'大号篮球'--首先查找该节点下所有子接点
create function f_cid(@id int)
returns @t table(id int,parentid int,desn varchar(10),lev int)
as
begin
declare @lev int
set @lev=1
insert into @t select *,@lev from os where id=@id
while(@@rowcount>0)
begin
set @lev=@lev+1
insert into @t select a.*,@lev from os a,@t b
where a.parentid=b.id and b.lev=@lev-1
end
return
end--调用:
select * from dbo.f_cid(1)