Need Help With Insert Or Update From Excel

Nov 26, 2006

Hello -

I have an Excel data source from a customer. The data source is a daily dump from the customer's HR system - bascially data about people. Some of these are new (to the data source) and some already exist in my database (from a previous import).

What I am trying to do is: If the row in Excel is new, then INSERT the data into my table. If the row in Excel already exists in my database, then I just want to UPDATE the data in my table.

The Excel data contains an ID field from the HR system that I store in my table for lookups. However, I also generate an ID from my table, when the data is inserted.

I have a Lookup task that uses the HR system ID from the Excel file and this will return the rows that already exist. These are the rows I want to update. One question is: Do I use the OLE DB Command task for this operation?

Second, how do I determine the rows that don't exist? I am assuming that the Lookup task only returns those rows that match. And, unlike the conditional split, there doesn't appear to be another path that the unmatched data can be sent to.

thanks

- will

View 4 Replies


ADVERTISEMENT

Update Or Insert Into SQL Table From Excel Source

Aug 29, 2006

Hi all,



I've had little success gooling/searching for this (so far).



Given a simple spreadsheet:

StoreNumber StoreName

1
UPDStoreName_1

2
UPDStoreName_2

3
UPDStoreName_3

4
NEWStoreName_4



I want to have an SSIS package that will update a table: mystores (storenumber int, storename nvarchar(255))

StoreNumber StoreName

1
StoreName_1

2
StoreName_2

3
StoreName_3

5 StoreName_5



.. what I need to do is insert the new, update the existing and leave the remaining unchanged. i.e. :



StoreNumber StoreName

1
UPDStoreName_1

2
UPDStoreName_2

3
UPDStoreName_3

4
NEWStoreName_4

5 StoreName_5



(the UPD and NEW are added to simplify the example).



Now the default action of an excel source into an ole db destination is
an insert into the table - so PK constraints causes failures.



Now, given that the table is referred to by other table, and is in a
24x7 website, how do I change the SSIS package such that, on a
row-by-row basis, anUpSert (update or insert) is performed?



The only idea I have so far is:



create temp table

insert excel data into temp table

iterate through the table, using if exists ... update else insert logic <-- this to be done in a SP



Isn't there a better way?

View 7 Replies View Related

UPDATE SQL Statement In Excel VBA Editor To Update Access Database - ADO - SQL

Jul 23, 2005

Hello,I am trying to update records in my database from excel data using vbaeditor within excel.In order to launch a query, I use SQL langage in ADO as follwing:------------------------------------------------------------Dim adoConn As ADODB.ConnectionDim adoRs As ADODB.RecordsetDim sConn As StringDim sSql As StringDim sOutput As StringsConn = "DSN=MS Access Database;" & _"DBQ=MyDatabasePath;" & _"DefaultDir=MyPathDirectory;" & _"DriverId=25;FIL=MS Access;MaxBufferSize=2048;PageTimeout=5;" &_"PWD=xxxxxx;UID=admin;"ID, A, B C.. are my table fieldssSql = "SELECT ID, `A`, B, `C being a date`, D, E, `F`, `H`, I, J,`K`, L" & _" FROM MyTblName" & _" WHERE (`A`='MyA')" & _" AND (`C`>{ts '" & Format(Date, "yyyy-mm-dd hh:mm:ss") & "'})"& _" ORDER BY `C` DESC"Set adoConn = New ADODB.ConnectionadoConn.Open sConnSet adoRs = New ADODB.RecordsetadoRs.Open Source:=sSql, _ActiveConnection:=adoConnadoRs.MoveFirstSheets("Sheet1").Range("a2").CopyFromRecordset adoRsSet adoRs = NothingSet adoConn = Nothing---------------------------------------------------------------Does Anyone know How I can use the UPDATE, DELETE INSERT SQL statementsin this environement? Copying SQL statements from access does not workas I would have to reference Access Object in my project which I do notwant if I can avoid. Ideally I would like to use only ADO system andSQL approach.Thank you very muchNono

View 1 Replies View Related

SQL Server 2008 :: Update Null Enabled Field Without Interfering With Rest Of INSERT / UPDATE

Apr 16, 2015

If I have a table with 1 or more Nullable fields and I want to make sure that when an INSERT or UPDATE occurs and one or more of these fields are left to NULL either explicitly or implicitly is there I can set these to non-null values without interfering with the INSERT or UPDATE in as far as the other fields in the table?

EXAMPLE:

CREATE TABLE dbo.MYTABLE(
ID NUMERIC(18,0) IDENTITY(1,1) NOT NULL,
FirstName VARCHAR(50) NULL,
LastName VARCHAR(50) NULL,

[Code] ....

If an INSERT looks like any of the following what can I do to change the NULL being assigned to DateAdded to a real date, preferable the value of GetDate() at the time of the insert? I've heard of INSTEAD of Triggers but I'm not trying tto over rise the entire INSERT or update just the on (maybe 2) fields that are being left as null or explicitly set to null. The same would apply for any UPDATE where DateModified is not specified or explicitly set to NULL. I would want to change it so that DateModified is not null on any UPDATE.

INSERT INTO dbo.MYTABLE( FirstName, LastName, DateAdded)
VALUES('John','Smith',NULL)

INSERT INTO dbo.MYTABLE( FirstName, LastName)
VALUES('John','Smith')

INSERT INTO dbo.MYTABLE( FirstName, LastName, DateAdded)
SELECT FirstName, LastName, NULL
FROM MYOTHERTABLE

View 9 Replies View Related

Can I Insert/Update Large Text Field To Database Without Bulk Insert?

Nov 14, 2007

I have a web form with a text field that needs to take in as much as the user decides to type and insert it into an nvarchar(max) field in the database behind.  I've tried using the new .write() method in my update statement, but it cuts off the text after a while.  Is there a way to insert/update in SQL 2005 this without resorting to Bulk Insert? It bloats the transaction log and turning the logging off requires a call to sp_dboptions (or a straight-up ALTER DATABASE), which I'd like to avoid if I can.

View 6 Replies View Related

T-SQL (SS2K8) :: Insert / Update Triggers When Insert Run Via Script

Oct 23, 2014

I'm working on inserting data into a table in a database. The table has two separate triggers, one for insert and one for update (I don't like it this way, but that's how it's been for years). When there is a normal insert, done via a program, it looks like the triggers work fine. When I run an insert manually via a script, the first insert trigger will run, but the update trigger will fail. I narrowed down the issue to a root cause.

This root issue is due to both triggers using the same temporary table name. When the second trigger runs, there's an error stating that a few columns don't exist. I went to my test server and test db and changed the update trigger so that the temporary table is different than the insert trigger temporary table, the triggers work fine. The weird thing is that if the temporary table already exists, when the second trigger tries to create the temporary table, I would expect it to fail and say that it already exists.I'm probably just going to update the trigger tonight and change the temporary table name.

View 1 Replies View Related

Trigger To Update A Table On Insert Or Update

Feb 15, 2008



Hello

I've to write an trigger for the following action

When a entry is done in the table Adoscat79 having in the index field Statut_tiers the valeur 1 and a date in data_cloture for a customer xyz

all the entries in the same table where the no_tiers is the same as the one entered (many entriers) should have those both field updated

statut_tiers to 1
and date_cloture to the same date as entered

the same action has to be done when an update is done and the valeur is set to 1 for the statut_tiers and a date entered in the field date_clture

thank you for your help
I've never done a trigger before

View 14 Replies View Related

Single Complex INSERT Or INSERT Plus UPDATE

Jul 23, 2005

Hello,I am writing a stored procedure that will take data from severaldifferent tables and will combine the data into a single table for ourdata warehouse. It is mostly pretty straightforward stuff, but there isone issue that I am not sure how to handle.The resulting table has a column that is an ugly concatenation fromseveral columns in the source. I didn't design this and I can't huntdown and kill the person who did, so that option is out. Here is asimplified version of what I'm trying to do:CREATE TABLE Source (grp_id INT NOT NULL,mbr_id DECIMAL(18, 0) NOT NULL,birth_date DATETIME NULL,gender_code CHAR(1) NOT NULL,ssn CHAR(9) NOT NULL )GOALTER TABLE SourceADD CONSTRAINT PK_SourcePRIMARY KEY CLUSTERED (grp_id, mbr_id)GOCREATE TABLE Destination (grp_id INT NOT NULL,mbr_id DECIMAL(18, 0) NOT NULL,birth_date DATETIME NULL,gender_code CHAR(1) NOT NULL,member_ssn CHAR(9) NOT NULL,subscriber_ssn CHAR(9) NOT NULL )GOALTER TABLE DestinationADD CONSTRAINT PK_DestinationPRIMARY KEY CLUSTERED (grp_id, mbr_id)GOThe member_ssn is the ssn for the row being imported. Each member alsohas a subscriber (think of it as a parent-child kind of relationship)where the first 9 characters of the mbr_id (as a zero-padded string)match and the last two are "00". For example, given the followingmbr_id values:1234567890012345678901123456789021111111110022222222200They would have the following subscribers:mbr_id subscriber mbr_id12345678900 1234567890012345678901 1234567890012345678902 1234567890011111111100 1111111110022222222200 22222222200So, for the subscriber_ssn I need to find the subscriber using theabove rule and fill in that ssn.I have a couple of ideas on how I might do this, but I'm wondering ifanyone has tackled a similar situation and how you solved it.The current system does an insert with an additional column for thesubscriber mbr_id then it updates the table using that column to joinback to the source. I could also join the source to itself in the firstplace to fill it in without the extra update, but I'm not sure if theextra complexity of the insert statement would offset any gains fromputting it all into one statement. I plan to test that on Monday.Thanks for any ideas that you might have.-Tom.

View 4 Replies View Related

Can I Roll Back Certain Query(insert/update) Execution In One Page If Query (insert/update) In Other Page Execution Fails In Asp.net

Mar 1, 2007

Can I roll back certain query(insert/update) execution in one page if  query (insert/update) in other page  execution fails in asp.net.( I am using sqlserver 2000 as back end)
 scenario
In a webpage1, I have insert query  into master table and Page2 I have insert query to store data in sub table.
 I need to rollback the insert command execution for sub table ,if insert command to master table in web page1 is failed. (Query in webpage2 executes first, then only the query in webpage1) Can I use System. Transaction to solve this? Thanks in advance

View 2 Replies View Related

Insert Procedure From Excel

Sep 29, 2007

Hi all

I need to create a stored procedure that will insert from an Excel document. And I'm not exaclty sure of how to do that.


CREATE PROCEDURE [Insert_ActiveSuspensions]

AS
INSERT INTO [GamingCommissiondb].[dbo].[License_SuspensionsView]
([TM #],
[FIRSTNAME],
[LASTNAME],
[SS #],
[REASONFORSUSPENSION],
[ENDDATE]
[BEGINDATE])


SELECT
[TM#],
[LASTNAME],
[FIRSTNAME],
[SSN#],
[NOTES],
[DATEOFCONDITIONAL]

FROM "C:Documents and SettingsDesiree StevensonMy DocumentsTerminationInserts.xls"
IF @@Error <> '0'



is this correct??

View 7 Replies View Related

Excel Range Insert

May 16, 2008



Hi I was wondering if anyone else was running into the problem where SSIS inserts data into a range incorrectly.

I have a Raw File Source in a Data Flow. The data is manipulated and then defined to insert into a named range within an Excel Worksheet. I have a task prior to the data flow that takes a template and copies it to another location. Within the Template I have defined several named ranges.

The Data Flow inserts the data in the line below the named range. For instance if I have a named range defined as B1:C1
the insert occurs on B2:C2

Does anyone know why this is happening or how I can get it to insert into the Range I have specified?

Thanks in advance!

View 3 Replies View Related

Update Table With Excel Data

Jun 17, 2005

Can anyone tell me how to update a sql server table with the data from excel sheet? That would be very helpful.Thanks.

View 6 Replies View Related

Possible To Update A Table Based On Excel?

May 14, 2006

Hi all
I was wondering if it was possible to update a table based off of information from Excel. here is what I though would have worked.


update MyTest Set acctNumber='111' FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=C:MyFile.xls;HDR=YES', 'SELECT * FROM [Sheet1$]') where [ProductGroup]='Hal Butts'

with 'Update MyTest' being the table name. It does have the same name as the excel file. Just to rule that out.

It gives me this error

Ambiguous column name 'ProductGroup'.

If it is possible what is the correct syntax??

tibor

View 7 Replies View Related

Update Table From Excel File

Oct 20, 2012

I use sql 2000. I have an excel table containing some fields with the first field named code, the same table with more fields exits in my sql database, the issue:

I want to UPDATE all of the fields in sql-db that matches the ones in the excel file where code of the record matches, in sql it sorta look like this:

update mytable (Fields 2, 3, 4,... till last one /the first is the code field/)
select * from openrowset('Microsoft.Jet.OLEDB.4.0','Excel 8.0;database=C:Book1.xls','select * from [Sheet1$]')
WHERE mytable.code = myexcel.code

View 6 Replies View Related

SQL UPDATE Database From Excel Table

Jul 23, 2005

I had previously posted this in an Access forumwith negative results so will try here.Although this question specifies an Access database,I also wish to accomplish this with a large MS SQL Serverdatabase that we have.Question follows:The following SQL statement, used in VBScript,will COPY a table from Excel to an Access mdb.SQL = "SELECT * INTO C1R0" & _" FROM [C1R0$] IN ''" & _" 'Excel 8.0;database=c:excelUpdateFinal1.xls';"What is the SQL statement that willUPDATE an already existing Access tablewith all rows from Excel spreadsheet?The columns of both Spreadsheet and database are thesame.ThanksJim

View 12 Replies View Related

OleDB Update To Excel Spreadsheet

Mar 12, 2008

Is there a limit to the number of fields that can be set in an OleDB Update Statement?

This works with 6 fields:
cmd.CommandText = "Update [Sheet2$A2:AP2] Set F1 = '1', F2 = '35062', F3 = '6', F4 = '620000.0000', F5 = '200000.0000', F6 = '700000.0000'"

This Fails with 7 fields:
cmd.CommandText = "Update [Sheet2$A2:AP2] Set F1 = '1', F2 = '35062', F3 = '6', F4 = '620000.0000', F5 = '200000.0000', F6 = '700000.0000', F7 = '123'"

The range should be plenty big with A2:AP2. In the end I'm trying to push 42 fields.


The complete segment is:

Dim ExcelConnection As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & ExcelFileName & ";" & _
"Extended Properties=""Excel 8.0;HDR=NO"""
Dim conn As New System.Data.OleDb.OleDbConnection(ExcelConnection)
Dim cmd As New System.Data.OleDb.OleDbCommand()

conn.Open()
cmd.Connection = conn

cmd.CommandText = "Update [Sheet2$A2:AP2] Set F1 = '1', F2 = '35062', F3 = '6', F4 = '620000.0000', F5 = '200000.0000', F6 = '700000.0000', F7 = '1234'"

cmd.ExecuteNonQuery()

View 1 Replies View Related

Insert Into Statement From Excel File

May 16, 2006

Hi all.
I am having trouble with an insert statement involving an excel file.

Insert into tpa00175 (intJobKey,BusinessFormKey,chrCustPONumber,chrExem ptNo,chrJobDescription1, chrJobName,
chrJobNumber,chrNxtVariationNum,chrUserDef1,chrUse rDef2,hrUserDef3,chrUserDef4,chrUserDef5,chrUserDe f6,chrUserDef7,
chrUserDef8,chrUserDef9,chrUserDef10,chrUserDef11, chrUserDef12,chrUserDef13,CompanyID,CustKey,dteCmp ltnDueDate,
dteCompletionDate,dteJobCommencement,dteReviewDate ,intClientContctKey,intDivisionKey,intEmployeeKey, intJobClassKey,
intMasterJobKey,MSTaxClassKey,numActualVarCosts,nu mActualVarSales,numCostsRecognized,numCreditLimit, numJobBudget,
numJTDActualCost,numJTDActualSale,numJTDCommitedCs ts,numJTDEstimatedCst,numJTDEstimatedSal,numLaborA ctual,
numLaborEstimate,numLaborForcast,numLastForcastCos t,numLastForcastSale,numMaterialActual,numMaterial Est,
numMaterialForcast,numOverHeadActual,numOverHeadEs t,numOverHeadForcast,numPercentComplete,numRetenti onAmtTTD,
numRetainageAmt,numRetentionBldTTD,numRetainagePrc nt,numSalesRecognized,numUser1ActlClass,numUser1Es tClass,
numUser1FrcstClass,numUser2ActlClass,numUser2EstCl ass,numUser2FrcstClass,numUser3ActlClass,numUser3E stClass,
numUser3FrcstClass,OpenOrClosed,PostIMGL,Retention AcctKey,siInvoiceLayout,siJobStatus,siJobType,siMa rginType,
siProfitRecMethod,siRetainageType,STaxClassKey,tiP rofRecByJobLine,TranID,UpdateCounter,WhseKey)
FROM OPENROWSET('Microsoft.Jet.OLEDB.4.0','Excel 8.0;Database=C:Book1.xls;HDR=YES',
'SELECT * FROM [Sheet1$]')


its a long one for sure. 2 questions.

1)Is there a way to just say insert all rather than naming each row like the above example.

2)With this above example i am getting a syntax error near 'From'. What am I missing??

Thanks alot.

Tibor

View 10 Replies View Related

How To Insert Excel Data Into SQL Database?

Dec 24, 2006

Hello to All,

I'm searching a way get Excel data into SQL database and tried this "insert" process that given me error. Already create a table call "original_purged" contain column fields. Can anyone give me some tips to show the problem?

INSERT Original_Purged

SELECT OP_ID,RBDI,Title,Address,City,State,Zip,Plus4,Walkseq,Crrt,Endorse,City_rural,Dpb,Dpbc,updatedate
FROM OpenDataSource( 'Microsoft.Jet.OLEDB.4.0',
'Data Source="C:Original_Purged.xls";User ID=Ryan;Password=dellonee1405;Extended properties=Excel 5.0')...[52117639]
==========================================================
Error occur.............

Server: Msg 7399, Level 16, State 1, Line 1
OLE DB provider 'Microsoft.Jet.OLEDB.4.0' reported an error. Authentication failed.
[OLE/DB provider returned message: Cannot start your application. The workgroup information file is missing or opened exclusively by another user.]
OLE DB error trace [OLE/DB Provider 'Microsoft.Jet.OLEDB.4.0' IDBInitialize::Initialize returned 0x80040e4d: Authentication failed.].


thank you
ryan,


RV

View 5 Replies View Related

Update Table From Linked Excel Sheet

Mar 20, 2008

I cant seem to reference columns within a linked Excel server
using MS SQL express

Code:

UPDATE dbo.Items
SET CCC=XL_SERVER.CCC
FROM XL_SERVER...sheet1$
WHERE BBB LIKE '7%'

i.e I want to update column CCC in my Items table from an Excel table column CCC where column BBB begins with 7

I have set up XL_SERVER correctly.

Help!

View 3 Replies View Related

Update SQL Database Using Excel Sheet As Input

Apr 24, 2007

Hi

I am a very beginner in SQL and know a little bit VB.

I created a database table with two columns, one for key and the other for data. I'd like to update the data column using excel sheet which contains the same columns, key and data.

Does anyone have a sample VB code to share.

Thanks

Al

View 3 Replies View Related

Insert Data To Excel Through Execute Sql Task

Jun 7, 2006

How can i insert data into an excel sheet using an Execute Sql Task? is it possible?

View 1 Replies View Related

Create, Insert And Format Into 1,000 Excel Files

Feb 24, 2008

Hello,

I need to create about 1,000 (literately) Excel files that each contain 5 tabs. The data being placed on the tabs will always be the same (meaning the columns are static).
I am fairly advanced at Excel VBA so I can write code that does all the following in Excel (looped 1,000 times):


Open an Excel template

Bring data in from the tables

Filter, then copy-paste the appropriate rows into each tab.

Save the new Excel file.

Email the file to appropriate individual (it is a Microsoft Exchange Server).
As I started this in VBA, I thought that I might be able to do it with SSIS. My concern is I need to have the rows formatted (font, border, etc.) and the number of rows change.

My questions are:
Is it possible to format Excel with SSIS?
Can I email the files even if it is not with an SMTP protocol?
Would SSIS process this data faster then Excel?
Does this approach even make sense? Am I better just doing it with VBA?


Thank you for the help.

-Gumbatman

View 4 Replies View Related

Transact SQL :: Insert Data Into Excel Using OPENDATASOURCE

May 14, 2015

While trying to insert data into existing XLS file, using below command, i am getting following error.

Insert into OPENDATASOURCE( 'Microsoft. ACE.OLEDB.12.0','Data Source=e:ediuploadhello1.xlsx;Extended Properties=Excel 12.0')...[Sheet1$]
Select top 50 product_no From product_mst
Msg 7343, Level 16, State 2, Line 1
The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" could not INSERT INTO table "[Microsoft.ACE.OLEDB.12.0]". Unknown provider error.

View 2 Replies View Related

Problems Trying To Insert Data Into The Database Using Excel

Oct 31, 2007


Hi all,

I have encountered a problem. In the past i run a sql query to select all the data from the excel file and insert them into my SQL database. However recently i encountered an error when i run the query.

Msg 7399, Level 16, State 1, Line 4
The OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "excel_ls" reported an error. The provider did not give any information about the error.
Msg 7303, Level 16, State 1, Line 4
Cannot initialize the data source object of OLE DB provider "Microsoft.Jet.OLEDB.4.0" for linked server "excel_ls".

How i solve this error. Any ideas?


Thanks

View 1 Replies View Related

Transact SQL :: Incremental Primary Key Insert From Excel To DB?

Jul 6, 2015

I have a table Employee which has following values:

Employee ID Employee Name
1                     A
2                     B
3                     D

Now I have a excel file which will have the new data and I have to write a stored procedure to insert data from Excel file to this table.

Where Employee Id should be auto calculated and the value shud insert from 4.

View 9 Replies View Related

Importing Data From Excel To Update Existing Fields

May 12, 2004

I have an excel file that contains column A with names of components and products followed by column B which has each respective quantity on hand. I want to import that data to our website's SQL database that has a products table with a column, Pf_ID, that has only product names not component names and In_Stock which contains out-dated information that I want updated from column B of the excel file.

I think I've figured out how to use DTS and update the two fields, but I'm afraid that when everything runs new entries will be created with component information. Is it possible to specify that only rows where Pf_ID matches some row in column A that same row's column B will be used to update the data in In_Stock. I may have just made things too confusing than they need to be, but I don't have much experience with EM or Excel.

I'm also considering trying to write a macro that will match Pf_IDs in an exported excel file of the products table and take rows out of the excel file with current quantity information putting them in a new excel file to import into the website's database.

Please help, this is getting really confusing.

View 4 Replies View Related

Transact SQL :: Update Query In Powershell From Excel Sheet

May 12, 2015

I am trying to update my SQL table using an update query in powershell from an excel sheet.

The query is as follows,

#building name from excelsheet
 $TCell=$reader.GetValue(8);
#update query is as,
 $CreateScript1= "UPDATE $DestinationTable SET $DestinationTable.Phone = '$SCell' WHERE RoomNumber = '$FCell' and buildingname
like ''$TCell'%'"

I want to use like operator in the query to compare building name from excel sheet with the building name in sql table. I am facing an error in the highlighted part. I am not sure if my query is right or wrong.

View 2 Replies View Related

Transact SQL :: Raw Excel File - Create Automated Insert Into DB

Sep 17, 2015

I have a raw excel file which I am trying to create an automated insert into a DB.

Data in excel file is two columns, Row_Data, Row_ID

I am trying to split rows and store them in columns in a table.

Row_ID column is simply row identifier column

E.g.:

Row_Data  Row ID
Frank          2
Seattle            3
WA           4
34     5
1010.00   6

How can i insert this data into a table where i`ll have columns of Name, City, State, Age and Amount?

View 18 Replies View Related

Can We Use Excel File (source) For Bulk Insert Task

Jun 1, 2007

Can an excel file be used as a source for a Bulk Insert Task in SSIS instead of a delimited flat file?

View 6 Replies View Related

How Can I Create A DTS Package To Update A Table With Data From An Excel Spreadsheet?

Jul 9, 2006

Every month a client sends a spreadsheet with data which we use to update matching rows in a table in the database. I want to automate this using a DTS package but am having quite a bit of trouble accomplishing what I think should be trivial task. I've been attempting to use a Transform Data Task with a modification lookup but I just keep inserting the rows from the source excel spreadsheet in to the existing destination table without ever modifying the existing data.

Any guidance would be greatly appreciated as to a best practice approach.

View 3 Replies View Related

(urgent)Insert Data From A Excel Spread Sheet To SQl Server

Oct 4, 2007

Hi,
 
  I have a spread sheet which has 4 columns called cusip, Chartheader, growthdates and NAV.. and i also have the same number of columns in the Sql server... and I want to add another column called Rownumber and set it as int indentity... and when i try to import the data to sql server i am getting this error called
Received an invalid column length from the bcp client for colid 1.
 
How should i fix it.
Regards
Karen

View 7 Replies View Related

SQL 2012 :: Insert Outstanding Totals Into Different Columns In Excel Sheet

Jul 21, 2014

I have a data table which has list of bills with date and outstanding total.

If the bills dates between 0 and 30 I like to insert the Outstanding total into Colum K ,
If the bills dates between 31 and 60 I like to insert the Outstanding total into Colum L ,
If the bills dates between 61 and 90 I like to insert the Outstanding total into Colum M and so on ..

I tried below formula but it is not working

CASE DATEDIFF(day, Ac_Billbook.BillDate, getdate()) Between 0 and 30 THEN Insert into (Ac_Billbook.OutstandingTotal) Value ('K')
CASE DATEDIFF(day, Ac_Billbook.BillDate, getdate()) Between 31 and 60 THEN Insert into (Ac_Billbook.OutstandingTotal) Value ('L')
CASE DATEDIFF(day, Ac_Billbook.BillDate, getdate()) Between 61 and 90 THEN Insert into (Ac_Billbook.OutstandingTotal) Value ('M')

View 9 Replies View Related

DB Engine :: How To Insert Excel File Data Into Temp Table

Jul 9, 2015

I have an Excel file with .csv extension . it has on sheet with name Sheet1.

Now, I'm trying to insert this Excel data into one #temp table. I tried with syntax:

----------------
Exec sp_configure 'show advanced options', 1;
RECONFIGURE;
GO
Exec sp_configure 'Ad Hoc Distributed Queries', 1;
RECONFIGURE;
GO
EXEC master.dbo.sp_MSset_oledb_prop N'Microsoft.ACE.OLEDB.12.0' , N'AllowInProcess' , 1; 

[Code] ...

But, I'm getting error:

The OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)" reported an error. The provider did not give any information about the error.

Cannot initialize the data source object of OLE DB provider "Microsoft.ACE.OLEDB.12.0" for linked server "(null)".

If I'm executing for .xls file this statement is working finr and rows are inserted into #temp table. How to take excel file of .csv extension??

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved