sql server - sql query to insert received parameters from user, and Get records from a existing table and insert into another existing table -


anyone please me

here stored procedure in sql server:

alter procedure existingbook    @title nvarchar(50),    @author  nvarchar(50),    @number  nvarchar(50)    declare @sno int      begin       if exists(select * students title = @title)       begin          select @sno = count(*)          teacher           if (@author='proof')             if (@number>'20')                insert teacher(@sno+1, team, @title, getdate(),                                     @number, pmname, comments, isbn, null, null)           select             team, pmname, comments, isbn          students          title = @title          end    end 

when execute above query error

the name "team" not permitted in context. valid expressions constants, constant expressions, , (in contexts) variables. column names not permitted.

i knew reason above query

i tried in different way query execute records duplicated

please 1 me

insert query not formed correctly.

i think want like

    insert teacher             (              col1,               col2,              col3,              col4,              col5,              col6,              col7,              col8,              col9             )             select             @sno+1,             team,              @title,             @number,             pmname,             comments,             isbn,              null,              null             students title=@title  

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -