Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 How to Find Not Null Cloumn

Author  Topic 

skaswani
Starting Member

24 Posts

Posted - 2012-11-01 : 15:46:33
Dear All,

I am using SQL Server 2008, Windows 7


I have 2 tables

1) Table where I store data (from a Text file) - tblBillXYZ
2) Table where I Store the sequence (From Text File ) Based on Clients - tblFieldsReferences



Table tblBillXYZ have fields - as already mention this table will store data from text file depending the company profile/field template

1) ID (auto number)
2) Cust_ID (varchar 10)
3) Cust_Name (varchar(200)
4) Amount_X (numberic (10,2)
5) FF_VC1 varchar(200)
6) FF_VC2 varchar(200)
7) FF_VC3 varchar(200)
8) FF_Date1 date,
9) FF_Date2 date,
10) FF_Date3 date,
11) FF_Number1 numeric(10,2)
12) FF_Number2 numeric(10,2)
13) FF_Number2 numeric(10,2)



Table tblFieldsReferences - This table will have just reference sequence to read text file


1) Client ID (varchar(10)
2) Cust_ID (int)
3) Cust_Name (int)
4) Amount_X (int)
5) FF_VC1 varchar (int)
6) FF_VC2 varchar (int)
7) FF_VC3 varchar (int)
8) FF_Date1 (int),
9) FF_Date2 (int)
10) FF_Date3 (int)
11) FF_Number1 (int)
12) FF_Number2 (int)
13) FF_Number2 (int)

Suppose if XYX Company text file just have 5 columns
i.e

Customer No - can use Cust_ID field
Customer Name - can use Cust_Name field
Amount - use Amount_X field
Due Date can use FF_Date1 field


sample text field

123,SAJJAD,500,12-10-2012
124,SQL,800,10-10-2012
125,TEST,580,11-10-2012

Question
how can find not null column with position from 2nd table

Thanks

Bustaz Kool
Master Smack Fu Yak Hacker

1834 Posts

Posted - 2012-11-01 : 17:21:49
I'm not clear of what results you want. Can you clarify with some examples?

=================================================
We are far more concerned about the desecration of the flag than we are about the desecration of our land. -Wendell Berry
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2012-11-02 : 04:42:42
If you are using Import/Export wizard and have limited columns data (input), then map to specific table columns only

--
Chandu
Go to Top of Page
   

- Advertisement -