|
database
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
DTS package for exporting data from excel into temp tblI need to create a DTS package , which will export data from excel into temp
table in MS SQL and then use stored proc to manipulate this data from temp table and some permanent tables. Any help will be appreciated. Regards, Ilin -- Message posted via SQLMonster.com http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-programming/200507/1 "Ilin S via SQLMonster.com" <fo***@SQLMonster.com> wrote in message Try using the DTS Import Wizard.news:5151D566CA1C3@SQLMonster.com... > I need to create a DTS package , which will export data from excel into temp > table in MS SQL and then use stored proc to manipulate this data from temp > table and some permanent tables. > Any help will be appreciated. > > Regards, > Ilin > In SEM, Right-Click Data Transformation Services->All Tasks->Import Data. Choose your Excel file as the Data Source and the SQL Server database you wish to work with as the Destination. It should give you a good start. Rick Sawtell Rick Sawtell wrote:
Show quote >> I need to create a DTS package , which will export data from excel into temp >> table in MS SQL and then use stored proc to manipulate this data from temp >[quoted text clipped - 3 lines] >> Regards, >> Ilin > >Try using the DTS Import Wizard. > >In SEM, Right-Click Data Transformation Services->All Tasks->Import Data. > >Choose your Excel file as the Data Source and the SQL Server database you >wish to work with as the Destination. > >It should give you a good start. > >Rick Sawtell -- Message posted via SQLMonster.com http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-programming/200507/1 I know how to do this, this is not a question. My question is: I need to
export the data from file into temporary table created on fly to be able then manipulate with this data using other tables and stored procs. I need to keep this temp table existing until DTS finish execute all tasks. Regards, Ilin Rick Sawtell wrote: Show quote >> I need to create a DTS package , which will export data from excel into temp >> table in MS SQL and then use stored proc to manipulate this data from temp >[quoted text clipped - 3 lines] >> Regards, >> Ilin > >Try using the DTS Import Wizard. > >In SEM, Right-Click Data Transformation Services->All Tasks->Import Data. > >Choose your Excel file as the Data Source and the SQL Server database you >wish to work with as the Destination. > >It should give you a good start. > >Rick Sawtell -- Message posted via SQLMonster.com http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-programming/200507/1 I would suggest not using the DTS, but rather the command line function,
OPENROWSET. Here is a sp that I built to import data from an excel spreadsheet into a new table in SQL Server. You could just as easily populate a temp table in the same manner. I would be careful importing mixed data types from excel(i.e. numbers and strings in the same ss column), and reset your registry key as suggested by http://www.sqldts.com/default.aspx?254 create procedure import_ss_into_new_table @ss_filename_path varchar(1000), @worksheet varchar(200), @newtable varchar(200) AS BEGIN declare @tempSql nvarchar(4000), @Value float select @tempSql = ' SELECT * into ['+ @newtable +'] FROM OPENROWSET(''Microsoft.Jet.OLEDB.4.0'', ''Excel 8.0; HDR=yes; IMEX=1; Database='+ @ss_filename_path +''', ''SELECT * FROM ['+ @worksheet +']'') ' print @tempSql exec sp_executesql @tempSql, N'@Value float output', @Value output end GO Archer Show quote "Ilin S via SQLMonster.com" wrote: > I know how to do this, this is not a question. My question is: I need to > export the data from file into temporary table created on fly to be able then > manipulate with this data using other tables and stored procs. I need to keep > this temp table existing until DTS finish execute all tasks. > Regards, > Ilin > > Rick Sawtell wrote: > >> I need to create a DTS package , which will export data from excel into temp > >> table in MS SQL and then use stored proc to manipulate this data from temp > >[quoted text clipped - 3 lines] > >> Regards, > >> Ilin > > > >Try using the DTS Import Wizard. > > > >In SEM, Right-Click Data Transformation Services->All Tasks->Import Data. > > > >Choose your Excel file as the Data Source and the SQL Server database you > >wish to work with as the Destination. > > > >It should give you a good start. > > > >Rick Sawtell > > > -- > Message posted via SQLMonster.com > http://www.sqlmonster.com/Uwe/Forums.aspx/sql-server-programming/200507/1 > Bagman,
Thanks for your advice but again: I can not create a permanent tables, I need to use just temp tables to export data to and be able to manipulate this data from temp tables (originally text or excel files) using other DB objects like other tables, stored proces (join them, etc.). In other words I need to select, update, etc. data from text or excel files joining it with data in MS SQL server tables w/out creating an intermediate permanent SQL tables. This should be an automatic task on scheduler. Regards, Ilin bagman3rd wrote: Show quote >I would suggest not using the DTS, but rather the command line function, >OPENROWSET. Here is a sp that I built to import data from an excel >spreadsheet into a new table in SQL Server. You could just as easily >populate a temp table in the same manner. I would be careful importing mixed >data types from excel(i.e. numbers and strings in the same ss column), and >reset your registry key as suggested by > >http://www.sqldts.com/default.aspx?254 > >create procedure import_ss_into_new_table >@ss_filename_path varchar(1000), >@worksheet varchar(200), >@newtable varchar(200) >AS >BEGIN >declare @tempSql nvarchar(4000), @Value float >select @tempSql = >' >SELECT * > into ['+ @newtable +'] >FROM OPENROWSET(''Microsoft.Jet.OLEDB.4.0'', ''Excel 8.0; HDR=yes; >IMEX=1; >Database='+ @ss_filename_path +''', >''SELECT * FROM ['+ @worksheet +']'') >' >print @tempSql >exec sp_executesql @tempSql, N'@Value float output', @Value output >end > >GO > >Archer > >> I know how to do this, this is not a question. My question is: I need to >> export the data from file into temporary table created on fly to be able then >[quoted text clipped - 19 lines] >> > >> >Rick Sawtell
Other interesting topics
|
|||||||||||||||||||||||