declare @n int
set @n=(select top 1 colname from table1)
insert into table2(colname) values(@n)
set @n=(select top 1 colname from table1)
insert into table2(colname) values(@n)
解决方案 »
- 哪位大侠讲讲分区表的知识啊
- CONVERT 转换时间的用法
- 100分 请教sql2000数据库频繁访问占资源的问题
- 求一条SQL语句, 一个根据一个表中的某个字段来更新另一个表
- 问个有点复杂的SQL
- BCP导出数据到EXCEL文件时,如何连字段名一起导出?
- 求一条查询SQL语句
- 请教远程数据同步问题--急!!!
- 。。。。。。。。数据库设计三级模式的关系(毕业答辩)很急。。。。。。。。
- 有人知道在ASP中如何实现对多个SQL SERVER数据表的查询,之后把查询结果存放到一个recordset对象中吗?高分!
- 添加數據(從一個表到另一個表)
- jsp中如何写jdbc-odbc桥连接sql server6.5的代码,在线等待!急!!!
asDeclare @personid as varchar(50)Declare personid_cursor2 cursor for select personid from f_person
open personid_cursor2fetch next from personid_cursor2 into @personidwhile @@fetch_status=0
begin
declare @name varchar(50)
select @name=name from f_person where personid=@personid
update f_follow set name=@name where personid=@personid
fetch next from personid_cursor2 into @personid
endclose personid_cursor2GO
///////////////////////////////////////////////////
此存储过程:
表f-person和表f-follow有相同的列name
他们相关联的是personid
把表f-person的name 放到 表f-follow的name
select b1,b2 from table2
where ................ ok!!!!
select b1,b2 from table2
where b1 not in (select a1 from table1 )
and b2 not in (select a2 from table2 )
and .........
select b1,b2 from table2
where b1 not in (select a1 from table1 )
and b2 not in (select a2 from table2 )
and .........