April 19, 2015 at 11:04 pm
Hi ,
I am having 100 of flat files need to load in respective staging table.
I want to create table on run time as per filename input
suppose if input filename is ABC then table name should be Staging_ABC
if file name is XYZ then it should be Staging_XYZ
Table structure is below need to create at run time
CREATE TABLE Staging_'Filename'(
[COL001] [varchar](4000) NULL,
[Id] [int] IDENTITY(1,1) NOT NULL,
[LoadDate] [datetime] NOT NULL default getdate()
)
I am having another varible @filename which store the filename value
Regards,
Vipin Jha
April 20, 2015 at 12:39 am
A quick question All these 100 flat files have a single common template (columns and data types). what you want to achieve once this working is done? because there will be too many table will be generated which are really hard to maintain even on the DEV side working. i am assuming this working is not the production.
April 20, 2015 at 6:30 pm
I'm agreeing with twin.devil here. Just make filename a column in one permanent table.
My thought question: Have you ever been told that your query runs too fast?
My advice:
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.
Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
Since random numbers are too important to be left to chance, let's generate some![/url]
Learn to understand recursive CTEs by example.[/url]
[url url=http://www.sqlservercentral.com/articles/St
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply