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

Thursday, March 29, 2012

Create table,fields come from csv file

I want to create a table automatically,and fields come from a csv file

any idea? TIA

One way is using two packages and a configuration file.

I'm assuming that you are constructing the name of the table on the fly. Note that the table MUST always have the same format.

First create a sample of what you want your table to look like.

Package 1:
Create an SSIS package that loads data from a CSV file into that table.
Make the tablename come from a variable.
Put the variable in a configuration table

Package 2:
Create a variable that will contain the table name.
Create a variable expressions that has the sql to create the table using the variable previously defined.
Create a variable expression that has the sql to update the variable in the configuration table from Package 1
Create a SQL Task to create the table
Create a SQL Task to update the configuration table variable
Create an Execute SSIS package task to execute Package 1

Similarly you can extend this to the source by scanning directories for files and loading different CSV files into different tables.

Hope this helps,

Larry

Tuesday, March 27, 2012

Create table problem

I have been trying to create a table since morning but it save as a system
table instead of a user table. anybody has any idea? I tried to create both
GUI(Enterprise) and Analyser prompt but all the the time system made a
system table instead of a user
thanksFarrukh wrote:
> I have been trying to create a table since morning but it save as a system
> table instead of a user table. anybody has any idea? I tried to create bot
h
> GUI(Enterprise) and Analyser prompt but all the the time system made a
> system table instead of a user
> thanks
It looks like somone has executed the sp_MS_upd_sysobj_category
procedure with a parameter value of 1. Execute it with the value 2
as parameter and verify that objects now created will not be
system objects.
I strongly recommend that you search the net and read up on this
procedure before executing it. It is an undocumented proc and should be
avoided.

Create table problem

I have been trying to create a table since morning but it save as a system
table instead of a user table. anybody has any idea? I tried to create both
GUI(Enterprise) and Analyser prompt but all the the time system made a
system table instead of a user
thanksFarrukh wrote:
> I have been trying to create a table since morning but it save as a system
> table instead of a user table. anybody has any idea? I tried to create both
> GUI(Enterprise) and Analyser prompt but all the the time system made a
> system table instead of a user
> thanks
It looks like somone has executed the sp_MS_upd_sysobj_category
procedure with a parameter value of 1. Execute it with the value 2
as parameter and verify that objects now created will not be
system objects.
I strongly recommend that you search the net and read up on this
procedure before executing it. It is an undocumented proc and should be
avoided.

Saturday, February 25, 2012

Create linked exchange server

I'm using sql server 2005 and exchange 2003. End result is I want to upload email attachments to a table in sql. No one seems to have any idea how do do this except with .net, which i know nothing about so not really an option for me. I found this bit of info with some extensive web searching. Can anyone help fill in the blanks? I can't get the linked server to work yet.

EXEC sp_addlinkedserver 'exchange',
'Exchange OLE DB provider',
'exoledb.DataSource.1',
'file:\\.\backofficestorage\mailservername\public folders'

Error received:The OLE DB provider "exoledb.DataSource.1" has not been registered.

Does the Exchange Ole DB Driver exist on the SQL Server machine? I am assuming the 2 services are not on the same machine. If not, you may need to install the Exchange SDK or management tools on the SQL Server to get the OleDB driver installed.

Create linked exchange server

I'm using sql server 2005 and exchange 2003. End result is I want to upload email attachments to a table in sql. No one seems to have any idea how do do this except with .net, which i know nothing about so not really an option for me. I found this bit of info with some extensive web searching. Can anyone help fill in the blanks? I can't get the linked server to work yet.

EXEC sp_addlinkedserver 'exchange',
'Exchange OLE DB provider',
'exoledb.DataSource.1',
'file:\\.\backofficestorage\mailservername\public folders'

Error received:The OLE DB provider "exoledb.DataSource.1" has not been registered.

Does the Exchange Ole DB Driver exist on the SQL Server machine? I am assuming the 2 services are not on the same machine. If not, you may need to install the Exchange SDK or management tools on the SQL Server to get the OleDB driver installed.