检索表中的行值 [英] retrieve the row values in the table

查看:73
本文介绍了检索表中的行值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

如何使用asp.net检索表中的行值?

例如,我在数据库SQL SERVER 2005中有两个具有相同字段的表.在第一个表中,它包含3行数据,第二个表为空,
如果我在第一张表中选择第三行,它将存储在第二张表中.(注意:第三行仅保存在第二张表中)

HEllO,

how can i retrieve the row values in the table using asp.net?

for Example i have two tables in database SQL SERVER 2005 with same fields. in first table it contains 3 rows of data and the second table is empty,
if i select the Third row in the first table it will be store in the second table.(Note:Third row only Saved in that Second table)

推荐答案


检查此
Hi ,
check this
Create PROCEDURE usp_test
(@name nvarchar(50))
AS
BEGIN
IF NOT EXISTS(select name from  dbo.Table_2 where  name=@name)
Begin
INSERT INTO dbo.Table_2 (name)
SELECT name FROM dbo.Table_1  WHERE name =@name
END
 ELSE
   BEGIN
   select -1
   END
END



最好的问候
米奥特沃里(M.Miotwalli)



Best Regards
M.Miotwalli


这篇关于检索表中的行值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆