I'm having a problem importing a table using DTS from DB2. It seems that SQL Server can't recognize the DB2 "Date" format (eg 07/25/2001), which includes no time element. I assumed that SQL Server would simply throw a 12:00 AM time on each date it encountered, but instead I get errors, and the fields aren't imported at all. Any ideas on how I can get SQL Server and DB2 to play nice while importing the date fields? Any and all suggestions would be greatly appreciated!
I'm using DTS to import data from an Access memo field into a SQL Server ntext field. DTS is only importing the first 255 characters of the memo field and truncating the rest.I'd appreciate any insights into what may be causing this problem, and what I can do about it.Thanks in advance for any help!
I'm importing data from an Access table and, of course, one field is a primary key. This field needs to be an autonumber. The problem is the data I'm importing isn't sequential.
Can I import the data, then alter the table to make the column increment or is there a way to create the table and make the field increment, but import non-sequential data?
Hi,I'm trying to import data to my database on the live server from my local server. However when I do this it doesn't seem to be importing the properties for the fields in the tables. How can I import the properties of the fields too?Thanks,Curt.
Problem importing data from flat file into decimal(9,2) field. The data in the flat file is 000001453 and I am copying it to a decimal(10,2) field and instead of showing up in the 0000014.53 it comes across as 0001453.00. I tried defining the input columns a few different ways but none seemed to work. How do I do this with SSIS or do I need to write a SP and use convert? Thanks.
I am using a BCP format file to import a CSV file. The file looks like the following:
"01","02"
The format file looks like the following:
6.0Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 2Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 1Â Â Â Â Â Â SQLCHARÂ Â Â Â 0Â Â Â Â Â 0Â Â Â Â Â Â """Â Â Â Â Â Â Â Â 0Â Â Â "" 2Â Â Â Â Â SQLINTÂ Â Â Â Â Â 0Â Â Â Â Â 0Â Â Â Â Â Â "",""Â Â Â Â Â 1Â Â MROS 3Â Â Â Â Â SQLINTÂ Â Â Â Â Â 0Â Â Â Â Â 0Â Â Â Â Â Â "" "Â Â Â 2Â Â MROF
When both the two fields are set to SQLCHAR data types the data imports successfully without the quotes as 01 and 02. These fields will always be numbers and I want them as integers so I set the data type to int in the database and SQLINT in the format file. The results was that the 01 became 12592 and the 02 became 12848. where these numbers are coming from?
Hi there. I'm trying to extract data from my SQL server & everything in the script I've got is working (extracting correct data) except for one field - which is for the most part it's off by +2 days (on a few occasions - I see it off by just +1 day or even +3, but it's usually the +2 days).
I'm told that it's due to the conversion formula - but - since SQL is not my native language, I'm at a bit of a loss.
The DB table has the date field stored as a type: CHAR (as opposed to 'DATE') Can anyone out there help?
I’m retrieving Yahoo quotes into my database and have run into an issue when the dates sometimes change format in the csv file retrieved.
I am retrieving  yahoo quotes via powershell, then running a package to import data to my table. This generally works expect when the yahoo date format changes.  In the yahoo csv file, the dates normally come through in dd/mm/yyyy format. I find when a quote is old the format changes to mm/dd/yyyy, just for that particular quote.
When this happens, the package fails because the quote date format does not match my destination table format. i.e. mm/dd/yyyy vs dd/mm/yyyy  When this occurs, I would like to skip the records in mm/dd/yyyy format altogether and have the rest of the quotes imported.  One approach I can think of is to import the dates as a text type and do some data validation / conversion once imported but it feels like adding unnecessary steps.
Is there some other way I can achieve this within the process I already have?
Hello,The select statement needs only 1 second to complete the query.But the update statement spends 30 minutes. Why?SELECT STATEMENT:declare @IDate smalldatetimeselect @IDate=col001 from USDayselect * from USDay Ajoin (select US990010, US990020, US990030, US990040, US990050, US990060,US990070 from US99000D where US990010=@IDate) B on A.col001=B.US990010 and A.col002=B.US990020where B.US990010 is not nullUPDATE STATEMENT:update US99000Dset US990030=A.col003,US990040=A.col004,US990050=A.col005,US990060=A.col006,US990070=A.col007from USDay Ajoin (select US990010, US990020, US990030, US990040, US990050, US990060,US990070 from US99000D where US990010=@IDate) B on A.col001=B.US990010 and A.col002=B.US990020where B.US990010 is not nullINDEX:clustered index: US990020, US990010non-unique index: US990010, US990020
I need to send an email when my 'LastRunDate' field is 30 days old (i.e. It should send an email if the LastRunField = 7/21/2007).
I would need to include the matching fields in the database (i.e. MachineID, Description, etc.) then update that field to todays date.
I have a few values in the 'Frequency' field such as Daily, Monthly, Yearly. Daily would be 24 hrs, monthly 30 days, yearly 365 days from the lastrundate.
I have a flat file that has a date column where the date fields look like 20070626, for example. No quotes.
The problem is that several of the date values are missing, and instead of the date value the field looks like this , ,
That is, there are several blank spaces where the date should be. The number of blank spaces between the commas doesn't appear to be a set number (and it could even be 8 blank spaces, I don't know, in which case I don't know if checking for the Len will produce the correct results, but that's another issue...)
So, similar to the numeric field blanks problem, I wrote a script to convert the field to null. This is the logic I used:
If Not Len(Row.TradeDate) = 8 Then
Row.TradeDate_IsNull = True
End If
The next step in my data flow after the script is a derived column where I convert TradeDate from 20070625 to 06/25/2007. So the exact error message I am receiving is this:
[OLE DB Destination [547]] Error: There was an error with input column "TradeDate - derived" (645) on input "OLE DB Destination Input" (560). The column status returned was: "The value could not be converted because of a potential loss of data.".
Do I need to add a conditional split after the script and BEFORE the derived column to redirect bad rows so they don't go to the derived column?
I am attempting to import a text file into a Sql Server table. The file contains a time field. The column in the table that I am trying to import into is a Smalldatetime field. The data looks like this "10:30". I keep getting errors on the import of the time field. Any suggestions?
I'm trying to import a text file into a table. The table has a nullable bit field. The corresponding field in the file has Y/N rather than 1/0. I'm getting an error on that column "The value could not be converted because of a potential loss of data.". So I'm assuming I need to convert the Y/N to a 1/0 under the "derived columns" step. Is that correct and can someone tell me how to do that exactly?
I'm importing a large text field from an Excel spreadsheet into my Sql dbase using Enterprise Manager and I'm getting the error message "Data for source column 31 'fieldname' is too large for the specified buffer size." How do I go about changing the buffer size to allow for larger text fields? Thank you.
I need to pass in null/blank value in the date field or declare the field as string and convert date back to string.
I tried the 2nd option but I am having trouble converting the two digits of the recordset (rs_get_msp_info(2), 1, 2))) into a four digit yr. But it will only the yr in two digits. The mfg_start_date is delcared as a string variable
option 1 I will have to declare the mfg_start_date as date but I need to send in a blank value for this variable in the stored procedure. It won't accept a null or blank value.
I am trying to drag data from Informix to Sql Server. When I kick off the package using an OLE DB Source and a SQL Server Destination, I get DT_DBDATE to DT_DBTIMESTAMP errors on two fields from Informix which are date data ....no timestamp part
I tried a couple of things:
Created a view of the Informix table where I cast the date fields as datetime year to fraction(5), which failed.
Altered the view to convert the date fields to char(10) with the hopes that SQL Server would implicitly cast them as datetime but it failed.
I'm importing a csv file into sql server and everything is working fine however here are my problems.
The csv file fields contain some money fields and even though my db column type is money the dts package console complains that my data type from the csv is of type string 'for the money value' and cannot be inserted into the db field because they don't match. I changed the db field to nvarchar and hey presto it works fine. Problem is that this is no good because the data in the db is no longer a money value and therefore I cannot query the way I should.
So basically how do i map my csv to pass its values as the right types instead of just string values. If this was in c# i could just assign the parameter types accordingly but I'm not sure how to with sqlservers dts package.
I am trying to populate a field in a SQL table based on the valuesreturned from using substring on a text field.Example:Field Name = RecNumField Value = 024071023The 7th and 8th character of this number is the year. I am able toget those digits by saying substring(recnum,7,2) and I get '02'. Nowwhat I need to do is determine if this is >= 50 then concatenate a'19' to the front of it or if it is less that '50' concatenate a '20'.This particular example should return '2002'. Then I want to take theresult of this and populate a field called TaxYear.Any help would be greatly apprecaietd.Mark
Brand new to this, so please bear with me.I'm using the following code fragment to update a datetime field on a SQL Server 2005 database table:cmd.CommandText = "Update Projects Set EntryDate = " & Convert.ToDateTime(txtEntryDate.Text)cmd.ExecuteNonQuery()The result of the update operation is the the database field contains the value "1900-01-01 00:00:00:000". This probably means that I passed nulls to SQL; however, I see a valid date in the txtEntryDate field on my web form (i.e., "06/18/2007"). I also did a "Response.write" to display the txtEntryDate and it looks Okay.Can someone tell me what I'm doing wrong?Thanks!Using Visual Web Developer 2005 Express.
I'm writing a view to check record counts in a table that has numerous datasets and therefore various "Activity Dates". Is it possible as part of the SQL statement to have a CASE statement for example so that it can identify the field to use as the activity date?
The field to use is being identified using a seperate table so at the moment I have CASE WHEN FieldToUse = '2' THEN MapCol ELSE '[Activity_Date]' END, where FieldToUse = '2' identifies the date field to use and the MapCol data is the field name to be used as the activity date.
My requirement is to get the latest start date after a gap in a month for each id and if there is no gap for that particular id minimum date for that id should be taken….Given below the scenario
ID Â Â Â Â Â StartDate 1 Â Â Â Â Â Â 2014-01-01 1 Â Â Â Â Â Â 2014-02-01 1 Â Â Â Â Â Â 2014-05-01-------After Gap Restarted 1 Â Â Â Â Â Â 2014-06-01 1 Â Â Â Â Â Â 2014-09-01---------After last gap restarted 1 Â Â Â Â Â Â 2014-10-01 1 Â Â Â Â Â Â 2014-11-01 2 Â Â Â Â Â Â 2014-01-01 2 Â Â Â Â Â 2014-02-01 2 Â Â Â Â Â Â 2014-03-01 2 Â Â Â Â Â Â 2014-04-01 2 Â Â Â Â Â Â 2014-05-01 2 Â Â Â Â Â Â 2014-06-01 2 Â Â Â Â Â Â 2014-07-01
For Id 1 the start date after the latest gap is  2014-10-01 and for id=2 there is no gap so i need the minimum date  2014-01-01
My Expected Output id       Startdate 1        2014-10-01 2        2014-01-01
I am trying to import a table from Pervasive into SQL 2000 however I am getting an error due to a date column with some dates of 0000-00-00. How can I import the data without errors?
I am very new to using SQL. Our department usually uses Brio to query the various databases under our control. However, I have recently come against a problem that prompted me to create a custom SQL query which works well as far as it goes. My problem is looking for specific conditions in billing information I receive monthly. I would like to compare on of the date fields contained in the database with a field in the form of YYYYMM (200710, for October 2007) I have created a custom column generator that forms a date from the YYYYMM. I would like, however, do the translation on the fly and make the comparison during the query. The problem is that query without the date check returns a mass of data, only about 1 percent of which is what I want.
The beginning of the SQL query looks like this:
FROM From.T_Crs_Tran_Dtl WHERE T_Crs_Tran_Dtl.Crs_Bill_Yr_Mo IN ('200710', '200711', '200712') AND ((T_Crs_Tran_Dtl.Crs_Cde IN ('1G', '1V') AND (T_Crs_Tran_Dtl.Dptr_Dte < LastDay(ToDate(Substr ( Crs_Bill_Yr_Mo, 5, 2 )& "/1/"&Substr ( Crs_Bill_Yr_Mo, 1, 4 )))) AND (T_Crs_Tran_Dtl.Prev_Stats_Cde IN (' ', 'TK', 'TL') AND T_Crs_Tran_Dtl.Cur_Stats_Cde IN ('TK', 'TL') AND T_Crs_Tran_Dtl.Std_Tran_Typ_Cde='B') OR (T_Crs_Tran_Dtl.Prev_Stats_Cde='UN' AND T_Crs_Tran_Dtl.Cur_Stats_Cde='XX' AND€¦
It is the €œ(T_Crs_Tran_Dtl.Dptr_Dte < LastDay(ToDate(Substr ( Crs_Bill_Yr_Mo, 5, 2 )& "/1/"&Substr ( Crs_Bill_Yr_Mo, 1, 4 )))) AND€? part of the query that is just plain wrong. The business part of this statement takes the YYYYMM field and turns it into a date which is the last day of YYYYMM.
I hope someone out there can help me with making this comparison.