tag:blogger.com,1999:blog-2379842053067321961.post7463634551430208838..comments2024-03-28T05:21:44.049-07:00Comments on Welcome To TechBrothersIT: How to Load Text /CSV files with same or less columns than destination table by using Script Task in SSIS Package - SSIS TutorialAamir Shahzadhttp://www.blogger.com/profile/16777994869678463807noreply@blogger.comBlogger10125tag:blogger.com,1999:blog-2379842053067321961.post-74387271403128314572023-01-25T07:07:34.193-08:002023-01-25T07:07:34.193-08:00How to Load CSV files with same or more columns in...How to Load CSV files with same or more columns in SSIS.<br /><br />we have two file - csv1, csv2<br /><br />csv1 has 9 columns and csv2 has 10 columns. <br />Vinodhttps://www.blogger.com/profile/09389378324625198657noreply@blogger.comtag:blogger.com,1999:blog-2379842053067321961.post-50383681257593468992021-11-11T09:57:51.095-08:002021-11-11T09:57:51.095-08:00can you also insert the filename, fileloaddate usi...can you also insert the filename, fileloaddate using the same codeSthembiso Mabonahttps://www.blogger.com/profile/09693869384068858807noreply@blogger.comtag:blogger.com,1999:blog-2379842053067321961.post-26055970435093232822021-08-24T00:48:54.148-07:002021-08-24T00:48:54.148-07:00Hi,
So I am getting this error and I am not sure ...Hi,<br /><br />So I am getting this error and I am not sure how to fix it:<br /><br />System.Data.SqlClient.SqlException (0x80131904): There are more columns in the INSERT statement than values specified in the VALUES clause. The number of values in the VALUES clause must match the number of columns specified in the INSERT statement.<br />at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)<br />at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)<br />at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)<br />at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)<br />at System.Data.SqlClient.SqlCommand.RunExecuteNonQueryTds(String methodName, Boolean async, Int32 timeout, Boolean asyncWrite)<br />at System.Data.SqlClient.SqlCommand.InternalExecuteNonQuery(TaskCompletionSource`1 completion, String methodName, Boolean sendToPipe, Int32 timeout, Boolean& usedCache, Boolean asyncWrite, Boolean inRetry)<br />at System.Data.SqlClient.SqlCommand.ExecuteNonQuery()<br />at ST_2301a917d093437cb5cbcc3dc745b478.ScriptMain.Main()<br />ClientConnectionId:06147bcb-a833-425b-9f04-e12f59ee2098<br />Error Number:109,State:1,Class:15<br /><br />What is basically happening is that I am loading a csv file with about 11K records, whenever it finish loading record number 9291 it throws that error, meaning record 9292 probably has an issue. The file I am loading has fewer records than the destination table in SQL, but that ain't an issue coz this Task Script should be able to load the file. <br /><br />Any suggestion on what the issue could be, thanks in advaance.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-2379842053067321961.post-83927529226581498712021-08-24T00:35:17.933-07:002021-08-24T00:35:17.933-07:00This comment has been removed by the author.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-2379842053067321961.post-74480446236409841912020-07-14T07:02:40.045-07:002020-07-14T07:02:40.045-07:00I have a CSV file which contains 10 records out of...I have a CSV file which contains 10 records out of which 9 records are in correct format and the 10th record is having a invalid date so that for me 9 records should get inserted into the SQL table for the 10th record in the log file i should get the error. Can you please help me outAshahttps://www.blogger.com/profile/05682200198445343191noreply@blogger.comtag:blogger.com,1999:blog-2379842053067321961.post-54701161776742002252020-03-02T06:04:49.226-08:002020-03-02T06:04:49.226-08:00how would you handle text qualifiers if exists for...how would you handle text qualifiers if exists for some records?Peymasterhttps://www.blogger.com/profile/14291689259855105209noreply@blogger.comtag:blogger.com,1999:blog-2379842053067321961.post-61684102347984785222020-02-27T11:55:27.896-08:002020-02-27T11:55:27.896-08:00This comment has been removed by the author.Peymasterhttps://www.blogger.com/profile/14291689259855105209noreply@blogger.comtag:blogger.com,1999:blog-2379842053067321961.post-75686178795730147862019-10-08T14:34:46.540-07:002019-10-08T14:34:46.540-07:00I'm going to have to solve this same issue as ...I'm going to have to solve this same issue as I implement this solution.<br />General CSV format would probably have quotes around any column "value" that includes a comma.<br />Knowing that, I am going to focus on the following line of code for a way to find all such instances of data enclosed in quotes with a comma that follows.<br /><br /> string query = "Insert into " + TableName + " (" + ColumnList + ") ";<br /> query += "VALUES('" + line.Replace(FileDelimiter, "','") + "')";<br /><br />Definitely activating that messagebox will help see what's being written.<br /> In the end,, something from the CSV like : "Bob, and Sons"<br /> will need to be converted in the query to: 'Bob, and Sons' <br />Before trying to write to the DB.<br />I'd be glad to collaborate on the solution and have checked the Notify Me boxMovinghttps://www.blogger.com/profile/10294738984828551678noreply@blogger.comtag:blogger.com,1999:blog-2379842053067321961.post-9330557478922946902019-10-08T14:20:10.269-07:002019-10-08T14:20:10.269-07:00Excellent article - this will assist me with sever...Excellent article - this will assist me with several issues of "Random Data Formats" that my partners are sending me.Movinghttps://www.blogger.com/profile/10294738984828551678noreply@blogger.comtag:blogger.com,1999:blog-2379842053067321961.post-1344773161775210022019-09-20T12:54:30.847-07:002019-09-20T12:54:30.847-07:00What if we have comma inside the data columns - it...What if we have comma inside the data columns - it considers as a column which is not correct, can you help me?mukeshhttps://www.blogger.com/profile/15792564158504812131noreply@blogger.com