Home All Groups Group Topic Archive Search About

Confusing question or should I address it some where else?

Author
9 Dec 2005 12:29 AM
sqlster
I posted a question here on 12/6/05 about importing data from .csv file and
no one addressed it.

Here is the link
http://www.microsoft.com/technet/community/newsgroups/dgbrowser/en-us/default.mspx?pg=5&guid=&sloc=en-us&dg=microsoft.public.sqlserver.programming&fltr=

And the title is
Subject: import data properly from csv file.

Should I post it some where else or the question was not clear?

Please let me know if there is a better design for this.

I would really appreciate it.

Thanks

Author
9 Dec 2005 1:17 AM
ML
Actually, this is the direct link to your original quiestion: http://msdn.microsoft.com/newsgroups/default.aspx?dg=microsoft.public.sqlserver.programming&mid=982398ca-9bbc-4c87-b7bd-4ca1138e86f3&sloc=en-us

I don't really see any need for a global temporary table here. Why can't you
simply query the file directly? You're building stairs in the football field.

If for some reason you do need a temporary table, create a local one (#name
instead of ##name). Of course local temporary tables are scope-specific, so
you'd have to create it in a top level procedure that starts the whole
process (creates the table, calls a sub procedure to import data, then does
the rest of transformations).


ML

---
http://milambda.blogspot.com/
Author
9 Dec 2005 5:39 AM
Steve Kass
Assuming you know the structure of the resulting table, which would
be likely if you have other code to process it, how about

create table #temptbl (
  thisCol thisType,
  thatCol thatType
)
insert into #temptbl exec (
  'SELECT * into ##temptbl FROM '+
  @linked_server + '...['+@file + '#' +
  @extension + ']')

-- process as before

drop table #temptbl

If this is all in a procedure, you don't have to explicitly drop
#temptbl, but it's not a bad idea to do so.

Steve Kass
Drew University

sqlster wrote:

Show quote
>I posted a question here on 12/6/05 about importing data from .csv file and
>no one addressed it.
>
>Here is the link
>
>http://www.microsoft.com/technet/community/newsgroups/dgbrowser/en-us/default.mspx?pg=5&guid=&sloc=en-us&dg=microsoft.public.sqlserver.programming&fltr=
>
>And the title is
>Subject: import data properly from csv file.
>
>Should I post it some where else or the question was not clear?
>
>Please let me know if there is a better design for this.
>
>I would really appreciate it.
>
>Thanks
>

>
Author
9 Dec 2005 4:40 PM
sqlster
ML and Steve,

Thank you very much...

Show quote
"Steve Kass" wrote:

> Assuming you know the structure of the resulting table, which would
> be likely if you have other code to process it, how about
>
> create table #temptbl (
>   thisCol thisType,
>   thatCol thatType
> )
> insert into #temptbl exec (
>   'SELECT * into ##temptbl FROM '+
>   @linked_server + '...['+@file + '#' +
>   @extension + ']')
>
> -- process as before
>
> drop table #temptbl
>
> If this is all in a procedure, you don't have to explicitly drop
> #temptbl, but it's not a bad idea to do so.
>
> Steve Kass
> Drew University
>
> sqlster wrote:
>
> >I posted a question here on 12/6/05 about importing data from .csv file and
> >no one addressed it.
> >
> >Here is the link
> >
> >http://www.microsoft.com/technet/community/newsgroups/dgbrowser/en-us/default.mspx?pg=5&guid=&sloc=en-us&dg=microsoft.public.sqlserver.programming&fltr=
> >
> >And the title is
> >Subject: import data properly from csv file.
> >
> >Should I post it some where else or the question was not clear?
> >
> >Please let me know if there is a better design for this.
> >
> >I would really appreciate it.
> >
> >Thanks
> >
> > 
> >
>

AddThis Social Bookmark Button