Click here to Skip to main content
15,890,882 members
Home / Discussions / Database
   

Database

 
QuestionSimple Table Design Question Pin
dataminers6-Feb-10 23:00
dataminers6-Feb-10 23:00 
AnswerRe: Simple Table Design Question Pin
Luc Pattyn7-Feb-10 2:26
sitebuilderLuc Pattyn7-Feb-10 2:26 
GeneralRe: Simple Table Design Question Pin
dataminers7-Feb-10 6:41
dataminers7-Feb-10 6:41 
AnswerRe: Simple Table Design Question Pin
Andy_L_J7-Feb-10 17:37
Andy_L_J7-Feb-10 17:37 
AnswerRe: Simple Table Design Question Pin
David Mujica8-Feb-10 5:20
David Mujica8-Feb-10 5:20 
QuestionI'm about to go nutz over here, what is it with the sql 2008 express and visual studios 2008 express that doesn't like my dataconnection? Pin
tonyonlinux6-Feb-10 16:24
tonyonlinux6-Feb-10 16:24 
AnswerRe: I'm about to go nutz over here, what is it with the sql 2008 express and visual studios 2008 express that doesn't like my dataconnection? Pin
Andy_L_J7-Feb-10 17:41
Andy_L_J7-Feb-10 17:41 
QuestionWhy is a null value still being passed to the next insert statement in this stored procedure? Pin
tonyonlinux6-Feb-10 10:11
tonyonlinux6-Feb-10 10:11 
CREATE PROCEDURE usp_AddBook
--Variables
@Title varchar(200),
@Price decimal(18,2),
@Keywords varchar(200),
@Retired bit

AS

BEGIN
SET NOCOUNT ON

DECLARE @bookId int -- SET A VARIABLE TO HOLD THE BOOKID SQL MAKES

-- INSERT THE BOOK INFORMATION 
SELECT @bookId = Book.ID from Book where Book.Title = @Title


IF @bookId = null
BEGIN
INSERT Book(Title,Price,Keywords,Retired)
VALUES
(@Title,@Price,@Keywords,@Retired)
SELECT @bookId = @@IDENTITY; -- SET THE BOOK ID TO THE ID SQL MADE
END


INSERT INTO BookNumber (BookID)
VALUES
(@bookId)
END


From my view It should check to see if the @bookID is null and if it is then do the insert
if its not null then the book already exist and i simply wanna insert the bookID into the booknumber table.
The sql manager keeps telling me I can't pass a null to booknumber.bookID (well yeah its non nullable column, but it shouldn't be getting a null value HELP PLEASE Smile | :)

THANKS!
AnswerRe: Why is a null value still being passed to the next insert statement in this stored procedure? Pin
Eddy Vluggen6-Feb-10 11:37
professionalEddy Vluggen6-Feb-10 11:37 
GeneralRe: Why is a null value still being passed to the next insert statement in this stored procedure? Pin
tonyonlinux6-Feb-10 12:13
tonyonlinux6-Feb-10 12:13 
QuestionSQLServer 2005 User Permission Pin
Tim Carmichael5-Feb-10 10:25
Tim Carmichael5-Feb-10 10:25 
AnswerRe: SQLServer 2005 User Permission Pin
Mycroft Holmes6-Feb-10 0:01
professionalMycroft Holmes6-Feb-10 0:01 
QuestionSQL express Pin
GauravKP5-Feb-10 8:11
professionalGauravKP5-Feb-10 8:11 
QuestionSQL SERVER 2008 Pin
jonhbt5-Feb-10 3:52
jonhbt5-Feb-10 3:52 
GeneralRe: SQL SERVER 2008 Pin
Tim Carmichael5-Feb-10 4:45
Tim Carmichael5-Feb-10 4:45 
GeneralRe: SQL SERVER 2008 Pin
jonhbt7-Feb-10 23:18
jonhbt7-Feb-10 23:18 
Questiondynamic sql search condition in store procedure Pin
Mogamboo_Khush_Hua4-Feb-10 20:21
Mogamboo_Khush_Hua4-Feb-10 20:21 
AnswerRe: dynamic sql search condition in store procedure Pin
Mycroft Holmes4-Feb-10 20:47
professionalMycroft Holmes4-Feb-10 20:47 
GeneralRe: dynamic sql search condition in store procedure Pin
Mogamboo_Khush_Hua5-Feb-10 0:58
Mogamboo_Khush_Hua5-Feb-10 0:58 
GeneralRe: dynamic sql search condition in store procedure Pin
Mycroft Holmes5-Feb-10 10:08
professionalMycroft Holmes5-Feb-10 10:08 
AnswerRe: dynamic sql search condition in store procedure Pin
Giorgi Dalakishvili5-Feb-10 9:02
mentorGiorgi Dalakishvili5-Feb-10 9:02 
QuestionTwo Instances Of SQL Server??? Pin
AmbiguousName4-Feb-10 4:23
AmbiguousName4-Feb-10 4:23 
AnswerRe: Two Instances Of SQL Server??? Pin
David Mujica4-Feb-10 5:08
David Mujica4-Feb-10 5:08 
GeneralRe: Two Instances Of SQL Server??? Pin
AmbiguousName4-Feb-10 6:36
AmbiguousName4-Feb-10 6:36 
AnswerRe: Two Instances Of SQL Server??? Pin
debrah.h484-Feb-10 19:43
debrah.h484-Feb-10 19:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.