Hello everyone,
I met a very difficult point when processing data transformation. The case is :
Need import customer's data files(text) to database, the files should have certain fields(columns), but sometime customer give additional fileds. These additional fields should be recorded to table, but the fields name and number are unknown. For ex
TableA stores additional columns, like this, Col1, Col2(or more columns), Col names are unknown. But I get Col1,Col2... value and stored in @Col, by using system Sp and system tables
ID, Col1, Col2
1 some1 some2
2 Null some3
3 some4 Null
TableB is created to store the TableA column info(just for not null info,see example), it should like this
ID ColName ColContent
1 Col1 some1
1 Col2 some2
2 Col2 some3
3 Col3 some4
I think it should use dynamic sql, and query Dynamic SQL in this Forum, but even I know some Dynamic SQL now, I still do't know how to solve this question. Can any one give me some directions. Hope you know what I mean as my English not good.
Thanks in advance
I met a very difficult point when processing data transformation. The case is :
Need import customer's data files(text) to database, the files should have certain fields(columns), but sometime customer give additional fileds. These additional fields should be recorded to table, but the fields name and number are unknown. For ex
TableA stores additional columns, like this, Col1, Col2(or more columns), Col names are unknown. But I get Col1,Col2... value and stored in @Col, by using system Sp and system tables
ID, Col1, Col2
1 some1 some2
2 Null some3
3 some4 Null
TableB is created to store the TableA column info(just for not null info,see example), it should like this
ID ColName ColContent
1 Col1 some1
1 Col2 some2
2 Col2 some3
3 Col3 some4
I think it should use dynamic sql, and query Dynamic SQL in this Forum, but even I know some Dynamic SQL now, I still do't know how to solve this question. Can any one give me some directions. Hope you know what I mean as my English not good.
Thanks in advance