create proc error

  • 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.

  • It's getting created successfully without any issue.

  • gurbanov.1984 (9/4/2013)


    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.

    Inside the SELECT statement you need to specify one single column name instead of using the asterix

    create procedure yerde

    @....

    as

    insert yerdeys(

    ...

    )

    select

    @phone,

    (select top 1 {columnname} from phone where phone=@phone),

    @yunvan,

    ...

    update phone

    set telUnvan=@yunvan

    where phone=@phone

    ** Don't mistake the ‘stupidity of the crowd’ for the ‘wisdom of the group’! **
  • thank you very much

    I have not seen

    sorry

  • no

    (select top 1 *from phone where phone=@phone) -- this is not a problem

    tO ARTICLE

    I corrected

    topic is closed

  • THANK YOU VERY MUCH

Viewing 6 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic. Login to reply