Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 create procedure error

Author  Topic 

pascal_jimi
Posting Yak Master

167 Posts

Posted - 2013-09-04 : 03:25:11
hi my friends


create procedure yerde

@phone decimal(18,0),
@unvan nvarchar(200),
@yunvan nvarchar(200),
@Sentar smalldatetime,
@naryadN smallint,
@naryadtar smalldatetime,
@sebebi nvarchar(200)
as
insert yerdeys(
phone ,
unvan ,
yunvan ,
Sentar ,
naryadN ,
naryadtar ,
sebebi
)
select
@phone,
(select top 1 *from phone where phone=@phone),
@yunvan,
@Sentar,
@naryadN,
@naryadtar ,
@sebebi
update phone
set telUnvan=@yunvan
where phone=@phone



---- error

Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.



http://sql-az.tr.gg/

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-09-04 : 03:40:11
insert yerdeys(
phone ,
unvan ,
yunvan ,
Sentar ,
naryadN ,
naryadtar ,
sebebi
)
select
@phone,
(select top 1 *from phone where phone=@phone), --Here make sure you have only one column)
@yunvan,
@Sentar,
@naryadN,
@naryadtar ,
@sebebi;

update phone
set telUnvan=@yunvan
where phone=@phone;



--
Chandu
Go to Top of Page

pascal_jimi
Posting Yak Master

167 Posts

Posted - 2013-09-04 : 03:53:13
no bandy
(select top 1 *from phone where phone=@phone) -- this is not a problem

tO ARTICLE
I corrected


topic is closed


http://sql-az.tr.gg/
Go to Top of Page

pascal_jimi
Posting Yak Master

167 Posts

Posted - 2013-09-04 : 03:55:36
THANK YOU VERY MUCH

http://sql-az.tr.gg/
Go to Top of Page
   

- Advertisement -