Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Wizzle
Jun 7, 2004

Most
Parochial
Poster


uh zip zoom posted:

I'm trying to use Microsoft Excel to build a script to insert spreadsheet data (and not the headers) into an MS SQL database, unfortunately I don't know jack about (read: forgot the first time I was told) the syntax involved with creating a string with Excel. Help?

There's an import utility for SQL 2005 that you can have generate the SQL syntax. It includes the ability to skip column headers and has a GUI for things like mapping columns. You could easily make it a SQL Agent job as long as your excel file is in a predictable place with a predictable name.

Alternatively, you could make a stored procedure that takes the file name/location as a parameter.

Adbot
ADBOT LOVES YOU

Wizzle
Jun 7, 2004

Most
Parochial
Poster


Victor posted:

I might make a thread about sweet SQL2005 features at some point, but I just wanted to get this out there: using cross apply/outer apply allows you to join a table-valued function to a table, using values from the table as input to the UDF. That's useful for, among other things, normalizing data with a CLR Regex Split function. I learned about this tonight, after getting pissed that there was no way to link a table-valued UDF to a table, since relations can't refer to each other outside of the join condition. SQL2005 to the rescue!

Can you elaborate on this or maybe give an example? I work with SQL 2005 a lot and I have no clue what you're talking about. :downs:

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply