Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old May 27th, 2006, 01:43 AM
Authorized User
 
Join Date: Apr 2006
Location: Jamnagar, Gujarat, India.
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
Reply With Quote
  #2 (permalink)  
Old May 27th, 2006, 03:50 AM
Authorized User
 
Join Date: Mar 2006
Location: , , .
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

Reply With Quote
  #3 (permalink)  
Old May 27th, 2006, 06:22 AM
Authorized User
 
Join Date: Apr 2006
Location: Jamnagar, Gujarat, India.
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
Reply With Quote
  #4 (permalink)  
Old May 27th, 2006, 07:48 AM
Friend of Wrox
 
Join Date: Jun 2003
Location: Hudson, MA, USA.
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
Reply With Quote
  #5 (permalink)  
Old May 28th, 2006, 11:33 PM
Friend of Wrox
 
Join Date: Dec 2004
Location: Chennai, Tamil nadu, India.
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
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 06:09 PM.


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