Showing posts with label idea. Show all posts
Showing posts with label idea. Show all posts

Tuesday, March 27, 2012

cursor on results from stored procedure?

I am working on a stored procedure that needs to pass through the results of another procedure, using a cursor. Any idea why this isn't working? The exec statement works fine when I try it on it's own.

DECLARE myCursor CURSOR
FOR (exec sp_splitstring @.array = @.searchstr, @.separator = ' ')
OPEN myCursorWhy not create a temp table instead of using a cursor.

create table #a
insert #a exec sp_...

This looks like you are processing csv strings - I usually do this by

create table #csvint (id int identity, myid int, value int)
exec spProcCsvint myid = 1, csv =@.csv

In this way you can hold a lot of array values in the same table identified by the myid value.
You can loop through the values using id - but usually you would just join to it.

Friday, February 17, 2012

CSV import into MS SQL.

Hello,
I am new to the world of databases and would appreciate a
critique/brain storm of my idea to load CSV data files into a MS SQL
database.
My problem is that I have multiple types of CSV files, ones with first
rows equaling the column names and some with accompanying .ini files
with more specific attribute information.
So, my idea is to convert these csv files into xml and then apply an
xsl transform to a generic xml format (with applicable tag names for
the db) - which that I can then insert into a MS SQL database using a
c# data layer.
Depending on the data I have to undertake different actions (i.e. new
data create new records or mark records as amended).
Does this sound like a reasonable approach, this must be a very common
task in the world of databases?
Thank you so much for your time,
Dan.
You can import csv files with DTS or BCP
DTS is the easiest, BCP is the fastest (if you have really big files)
Lookup DTS and BCP in BOL
A great DTS site is http://www.sqldts.com/
http://sqlservercode.blogspot.com/
"Dan E" wrote:

> Hello,
> I am new to the world of databases and would appreciate a
> critique/brain storm of my idea to load CSV data files into a MS SQL
> database.
> My problem is that I have multiple types of CSV files, ones with first
> rows equaling the column names and some with accompanying .ini files
> with more specific attribute information.
> So, my idea is to convert these csv files into xml and then apply an
> xsl transform to a generic xml format (with applicable tag names for
> the db) - which that I can then insert into a MS SQL database using a
> c# data layer.
> Depending on the data I have to undertake different actions (i.e. new
> data create new records or mark records as amended).
> Does this sound like a reasonable approach, this must be a very common
> task in the world of databases?
> Thank you so much for your time,
> Dan.
>
|||Thank-You .... Can't understand why that was so hard for me...
"Dan E" wrote:

> Hello,
> I am new to the world of databases and would appreciate a
> critique/brain storm of my idea to load CSV data files into a MS SQL
> database.
> My problem is that I have multiple types of CSV files, ones with first
> rows equaling the column names and some with accompanying .ini files
> with more specific attribute information.
> So, my idea is to convert these csv files into xml and then apply an
> xsl transform to a generic xml format (with applicable tag names for
> the db) - which that I can then insert into a MS SQL database using a
> c# data layer.
> Depending on the data I have to undertake different actions (i.e. new
> data create new records or mark records as amended).
> Does this sound like a reasonable approach, this must be a very common
> task in the world of databases?
> Thank you so much for your time,
> Dan.
>

CSV import into MS SQL.

Hello,
I am new to the world of databases and would appreciate a
critique/brain storm of my idea to load CSV data files into a MS SQL
database.
My problem is that I have multiple types of CSV files, ones with first
rows equaling the column names and some with accompanying .ini files
with more specific attribute information.
So, my idea is to convert these csv files into xml and then apply an
xsl transform to a generic xml format (with applicable tag names for
the db) - which that I can then insert into a MS SQL database using a
c# data layer.
Depending on the data I have to undertake different actions (i.e. new
data create new records or mark records as amended).
Does this sound like a reasonable approach, this must be a very common
task in the world of databases?
Thank you so much for your time,
Dan.You can import csv files with DTS or BCP
DTS is the easiest, BCP is the fastest (if you have really big files)
Lookup DTS and BCP in BOL
A great DTS site is http://www.sqldts.com/
http://sqlservercode.blogspot.com/
"Dan E" wrote:

> Hello,
> I am new to the world of databases and would appreciate a
> critique/brain storm of my idea to load CSV data files into a MS SQL
> database.
> My problem is that I have multiple types of CSV files, ones with first
> rows equaling the column names and some with accompanying .ini files
> with more specific attribute information.
> So, my idea is to convert these csv files into xml and then apply an
> xsl transform to a generic xml format (with applicable tag names for
> the db) - which that I can then insert into a MS SQL database using a
> c# data layer.
> Depending on the data I have to undertake different actions (i.e. new
> data create new records or mark records as amended).
> Does this sound like a reasonable approach, this must be a very common
> task in the world of databases?
> Thank you so much for your time,
> Dan.
>|||Thank-You .... Can't understand why that was so hard for me...
"Dan E" wrote:

> Hello,
> I am new to the world of databases and would appreciate a
> critique/brain storm of my idea to load CSV data files into a MS SQL
> database.
> My problem is that I have multiple types of CSV files, ones with first
> rows equaling the column names and some with accompanying .ini files
> with more specific attribute information.
> So, my idea is to convert these csv files into xml and then apply an
> xsl transform to a generic xml format (with applicable tag names for
> the db) - which that I can then insert into a MS SQL database using a
> c# data layer.
> Depending on the data I have to undertake different actions (i.e. new
> data create new records or mark records as amended).
> Does this sound like a reasonable approach, this must be a very common
> task in the world of databases?
> Thank you so much for your time,
> Dan.
>

CSV import into MS SQL.

Hello,
I am new to the world of databases and would appreciate a
critique/brain storm of my idea to load CSV data files into a MS SQL
database.
My problem is that I have multiple types of CSV files, ones with first
rows equaling the column names and some with accompanying .ini files
with more specific attribute information.
So, my idea is to convert these csv files into xml and then apply an
xsl transform to a generic xml format (with applicable tag names for
the db) - which that I can then insert into a MS SQL database using a
c# data layer.
Depending on the data I have to undertake different actions (i.e. new
data create new records or mark records as amended).
Does this sound like a reasonable approach, this must be a very common
task in the world of databases?
Thank you so much for your time,
Dan.You can import csv files with DTS or BCP
DTS is the easiest, BCP is the fastest (if you have really big files)
Lookup DTS and BCP in BOL
A great DTS site is http://www.sqldts.com/
http://sqlservercode.blogspot.com/
"Dan E" wrote:
> Hello,
> I am new to the world of databases and would appreciate a
> critique/brain storm of my idea to load CSV data files into a MS SQL
> database.
> My problem is that I have multiple types of CSV files, ones with first
> rows equaling the column names and some with accompanying .ini files
> with more specific attribute information.
> So, my idea is to convert these csv files into xml and then apply an
> xsl transform to a generic xml format (with applicable tag names for
> the db) - which that I can then insert into a MS SQL database using a
> c# data layer.
> Depending on the data I have to undertake different actions (i.e. new
> data create new records or mark records as amended).
> Does this sound like a reasonable approach, this must be a very common
> task in the world of databases?
> Thank you so much for your time,
> Dan.
>|||Thank-You .... Can't understand why that was so hard for me...
"Dan E" wrote:
> Hello,
> I am new to the world of databases and would appreciate a
> critique/brain storm of my idea to load CSV data files into a MS SQL
> database.
> My problem is that I have multiple types of CSV files, ones with first
> rows equaling the column names and some with accompanying .ini files
> with more specific attribute information.
> So, my idea is to convert these csv files into xml and then apply an
> xsl transform to a generic xml format (with applicable tag names for
> the db) - which that I can then insert into a MS SQL database using a
> c# data layer.
> Depending on the data I have to undertake different actions (i.e. new
> data create new records or mark records as amended).
> Does this sound like a reasonable approach, this must be a very common
> task in the world of databases?
> Thank you so much for your time,
> Dan.
>