Click here to Skip to main content
15,901,831 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

I have the following query in vb application:

VB
Else
        SQL = "Insert Into GRSEXPORT([Product Number (SKU)],[Serial Numbers],[Sell Through Quantity],[Programe ID],"
            SQL = SQL & "[Company Name],[Transaction Doc ID],[Partner Locn ID],[Transaction Date]"
            SQL = SQL & ") Values('" & rs.Fields("Product Number (SKU)") & "','"
            SQL = SQL & rs.Fields("Serial Numbers") & "','" & rs.Fields("Sell Through Quantity") & "','"
            SQL = SQL & rs.Fields("Programe ID") & "','" & Replace(rs.Fields("Seller - Company Name") & "", "'", "''") & "','"
            SQL = SQL & rs.Fields("Trans Doc ID") & "','" & rs.Fields("Partner Locn ID") & "" & "',#"
            SQL = SQL & rs.Fields("Trans Date") & "#)" 
           
            Cnn.Execute (SQL)
End If


Here, all the data are being inserted in a single row in the table. But I want only the null values in one row and non-null values in another row..

Can any one please suggest me how do I do this?

Regards,
Posted
Comments
walterhevedeich 28-Jul-11 1:48am    
Why would you want to do that? Or, did I just misunderstood your question? Your insert statement would obviously insert a single row. It seems you want 2 rows to be inserted? Perhaps you need explain more details of the problem. An example would probably help.
Raj.rcr 28-Jul-11 2:49am    
yes, u r right.. I want 2 rows to be inserted at the same time.. One for null values and another for non-null values
walterhevedeich 28-Jul-11 2:58am    
It makes no sense. Why would you want to insert a row that has null values?
Raj.rcr 28-Jul-11 3:37am    
It has condition.. I mean, It wil insert the sum of a column called sell thru quanity where serial no's are null..

I don't know why you want to do like this, but you can use Stored Procedure for that to execute multiple insert queries or you can write a Trigger for that also and perform multiple operations.
 
Share this answer
 
v2
If your wanting to separate null values into separate rows then it suggests to me that you have design issues! Personally I would make your user interface / code validate the data before you insert it into the database, thus removing null values.

These are just m thoughts as you haven't really explained why you want to do this
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900