• gurbanov.1984 (7/6/2013)


    i created procedure

    but this procedure inserted only phone

    create procedure inserttable1

    @phone int,

    @n nvarchar(30),@f nvarchar(30),@c nvarchar (30),@t nvarchar(30)

    as

    insert table1 select @phone,(select kod from table2 where name_='@n'),(select kod from table3 where f_name='@f'),

    (select kod from table4 where country='c'),(select kod from table5 where m_auto='@t')

    exec inserttable1 1111,'stivens','tayson','argentina','mersedec'

    select*from table1

    You don't need the quotes round the parameter names:

    create procedure inserttable1

    @phone int,

    @n nvarchar(30),@f nvarchar(30),@c nvarchar (30),@t nvarchar(30)

    as

    insert table1

    (phone,kod_name,kod_fname,kod_country,kod_auto)

    select @phone,(select kod from table2 where name_=@n),(select kod from table3 where f_name=@f),

    (select kod from table4 where country=@c),(select kod from table5 where m_auto=@t)