Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 27th, 2006, 01:43 AM
Authorized User
 
Join Date: Apr 2006
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to vivekshah Send a message via Yahoo to vivekshah
Default Problem creating Stored Procedure


Hello

I have an table in which one field is of data type bit. That column maintains the numeric boolean values like '1' & '0'.

WHile creating a stored procedure for inserting the value in the table
it is not allowing me to declare the variable of datatype bit.

What might be the reason or any idea regarding it.



Vivek Shah
__________________
Vivek Shah
 
Old May 27th, 2006, 03:50 AM
Authorized User
 
Join Date: Mar 2006
Posts: 31
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Vivek!

You problem is not clear to me. But, I may predict that - you must not have used set statement properly. There may be a case when you do not set it with 0 or 1, this may insert NULL in the table.
But, you mentioned that - This is not allowing you declare a variable of bit type. Don't analyze that bit can not be declared. There may be some scenario which disallows you declare it.
Tell us the part of code where you have declared bit variable and used it. That would be really helpful to find the problem.


- Som Dutt

 
Old May 27th, 2006, 06:22 AM
Authorized User
 
Join Date: Apr 2006
Posts: 36
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to vivekshah Send a message via Yahoo to vivekshah
Default


Hello
Below is the stored procedure that i had created
Code:
CREATE procedure POS_OrderLine
 @newOrderID varchar(50),
 @ItemID numeric (4),
 @productClass numeric(4),
 @MenuGroup varchar(50),
 @ProductName varchar(50),
 @LineNumber numeric(4),
 @UnitPrice float(8),
 @Extra bit(1),
 @Qty numeric(4),
 @comment varchar(200)
 --@cnt numeric(4),
-- @totcnt numeric(4)

AS

    Insert into OrderLine(OrderID, ItemID, ItemClass, MenuGroup, ProductName,LineNumber, UnitPrice, Extra, Quantity, Comment, CreatedOn )
    Values
    (@newOrderID,@ItemID,@productClass,@MenuGroup,@ProductName,@LineNumber,@UnitPrice,@Extra,@Qty,@Comment, getdate())

While compiling the Procedure it gives me an error

Invalid datatype for the parameter

And In the code in C# I have declared it as SqlDbType.Bit,

but the error i get is as below

"String was not recognized as a valid Boolean."


Vivek Shah
 
Old May 27th, 2006, 07:48 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 839
Thanks: 0
Thanked 1 Time in 1 Post
Default

The bit datatype declaration has no arguments.

Your parameter definition should read:

...
@Extra bit,
...

Jeff Mason
Custom Apps, Inc.
www.custom-apps.com
 
Old May 28th, 2006, 11:33 PM
Friend of Wrox
 
Join Date: Dec 2004
Posts: 307
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Vadivel Send a message via Yahoo to Vadivel
Default

Yes Jeff is right. Bit doesn't take any argument.

Best Regards
Vadivel

http://vadivel.blogspot.com





Similar Threads
Thread Thread Starter Forum Replies Last Post
creating variables in a Stored procedure miamikk SQL Language 1 June 4th, 2007 03:02 AM
Creating stored procedure with trigger (HOWTO ..) AzlanAziz SQL Language 0 January 16th, 2007 04:34 AM
Creating Charts Using Stored Procedure srinivasparimi SQL Server 2005 1 August 7th, 2006 06:45 AM
creating stored procedure drachx SQL Server 2000 2 October 14th, 2004 08:10 AM
Creating a stored procedure marthaj SQL Server ASP 8 June 10th, 2003 06:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.