Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I am running the below code and then getting an error message an not sure why? Msg 8101, Level 16, State 1, Procedure spstudentinsert, Line

I am running the below code and then getting an error message an not sure why? Msg 8101, Level 16, State 1, Procedure spstudentinsert, Line 26 An explicit value for the identity column in table 'student' can only be specified when a column list is used and IDENTITY_INSERT is ON.

create proc spstudentinsert ( @studentid int=null, @firstname varchar(30) = null, @lastname varchar(30) = null, @SS# int = null, @GPA int = null ) as begin if @studentid is null throw 50001, 'Missing id',1 else if @firstname is null throw 50001, 'Missing first name',1 else if @lastname is null throw 50001, 'Missing last name',1 else if @SS# is null throw 50001, 'Missing social security number',1 else if @GPA is null throw 50001, 'Missing the GPA',1 else Set identity_insert dbo.student on; insert into student values(@studentid,@firstname,@lastname,@SS#,@GPA) end

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems X Special Issue On Database And Expert Systems Applications Lncs 8220

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Stephen W. Liddle ,Klaus-Dieter Schewe ,Xiaofang Zhou

2013th Edition

3642412203, 978-3642412202

More Books

Students also viewed these Databases questions

Question

Relational Contexts in Organizations

Answered: 1 week ago