473,666 Members | 2,386 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Insert null values in MS SQL Sever 2000

I need to insert a null value in a table on MS SQL Server 2000 using a stored
procedure.
When I send no data to the stored procedure, I get an error saying that the
value cannot be null, but I did the table to receive null values.
I tried DBNull.Value but didn't work.
Thanks, Rodrigo.
Nov 17 '05 #1
3 7307
Do you have access to the Stored Procedure Code? Set a default value of
NULL on the Stored Procedure parameter; then when you want NULL inserted,
just don't pass that parameter to your SP. It will default to NULL and all
should be good.

"Rodrigo C. Souza" <Rodrigo C. So***@discussio ns.microsoft.co m> wrote in
message news:F3******** *************** ***********@mic rosoft.com...
I need to insert a null value in a table on MS SQL Server 2000 using a
stored
procedure.
When I send no data to the stored procedure, I get an error saying that
the
value cannot be null, but I did the table to receive null values.
I tried DBNull.Value but didn't work.
Thanks, Rodrigo.

Nov 17 '05 #2
Hi,

Why don't you try to run the query from Query Analizer and see what gives.

If still havin gproblem just post the code , the SP and the table definition
:)
cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Rodrigo C. Souza" <Rodrigo C. So***@discussio ns.microsoft.co m> wrote in
message news:F3******** *************** ***********@mic rosoft.com...
I need to insert a null value in a table on MS SQL Server 2000 using a
stored
procedure.
When I send no data to the stored procedure, I get an error saying that
the
value cannot be null, but I did the table to receive null values.
I tried DBNull.Value but didn't work.
Thanks, Rodrigo.

Nov 17 '05 #3
If you set the property "IsNullable " on your SqlParameter object to
true, then you should be fine.

Example:

SqlParameter myParam = new SqlParameter
( "@Descripti on"
, sqlDataType.Var Char
);

myParam.IsNulla ble = true;

Nov 17 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
6921
by: soni29 | last post by:
hi, i have a small question regarding sql, there are two tables that i need to work with on this, one has fields like: Table1: (id, name, street, city, zip, phone, fax, etc...) about 20 more columns Table2: name what i need help with is that table2 contains about 200 distinct names that i need to insert into table1, i'm using sql server, is there a
4
41583
by: brent.ryan | last post by:
How do I get the next int value for a column before I do an insert in MY SQL Server 2000? I'm currently using Oracle sequence and doing something like: select seq.nextval from dual; Then I do my insert into 3 different table all using the same uniqueID. I can't use the @@identity function because my application uses a connection pool and it's not garanteed that a connection won't be used
14
4286
by: serge | last post by:
I have a scenario where two tables are in a One-to-Many relationship and I need to move the data from the Many table to the One table so that it becomes a One-to-One relationship. I need to salvage the records from the many table and without going into detail, one of the reasons I can't do the opposite as there are records in the ONE table that I need to keep even if they don't have any child records in the MANY table. Below I created...
3
5768
by: Magnus Byne | last post by:
Hi, I have a problem using serializable transactions. In one transaction I select a single specific row from a table using a where clause (this causes it to acquire and hold a range lock). In another transaction I attempt to insert a new row into the table (which does not match the first transactions where clause), but it is blocked by the first transaction. The reading I have done on SQL Server suggests that I should be able to insert...
3
7362
by: V T | last post by:
Hello all, SQL Server 2000 documentation http://www.microsoft.com/technet/prodtechnol/sql/2000/reskit/part10/c3761.mspx states that if view is using "NOT NULL" columns of a base table, then insert/update performed on a view must provide dummy values for those columns, and code of the trigger should ignore them. But I cannot reproduce this restriction. Code below pasted to QueryAnalyser shows that I can not supply dummy values for...
6
3450
by: rn5a | last post by:
During registration, users are supposed to enter the following details: First Name, Last Name, EMail, UserName, Password, Confirm Password, Address, City, State, Country, Zip & Phone Number. I am using MS-Access 2000 database table for this app. Note that the datatype of all the fields mentioned above are Text. Apart from the above columns, there's another column in the DB table named 'RegDateTime' whose datatype is Date/Time which is...
3
4699
by: iKiLL | last post by:
Hi all I am having problems getting my SqlCeDataAdapter to Update the SQL Mobile Data base. i am using C# CF2. I have tried this a number of different ways. Starting with the command builder but eventually i wrote out the entire command my self, and still nothing. The only thing that i can think this that because i am trying to add a table that is created outside the data adaptor and then Merge/Copy the data into
2
22380
by: teddysnips | last post by:
I have an application that does some data manipulation of some tables to format a table for a report. 1. First I open the table that gives me the parameters for some later queries strSQL = "SELECT DISTINCT tblMain.MeasureID, MeasureName, CountryName, AxisID FROM tblMain;" Set rstMeasure = CurrentDb.OpenRecordset(strSQL) With rstMeasure
1
2645
by: EJO | last post by:
with sql 2000 enterprise Trying to build a stored procedure that will take the rows of a parent table, insert them into another table as well as the rows from a child table to insert into another table and be able to maintain the relationships between the parent/child rows of the new records. Something like old_id new_id
0
8440
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8355
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8550
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8638
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7381
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4193
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4365
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1769
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.