smalldatetime

How do I format dd-mmm-yy values in flat file to smalldatetime during data import?

孤街浪徒 提交于 2019-12-21 16:47:09
问题 I have a flat file which is imported into SQL Server via an existing SSIS package. I need to make a change to the package to accommodate a new field in the flat file. The new field is a date field which is in the format dd-mmm-yy (e.g. 25-AUG-11 ). The date field in the flat file will either be empty (e.g. a space/whitespace) or populated with a date. I don’t have any control over the date format in the flat file. I need to import the date field in the flat file into an existing SQL Server

How do I format dd-mmm-yy values in flat file to smalldatetime during data import?

僤鯓⒐⒋嵵緔 提交于 2019-12-21 16:46:13
问题 I have a flat file which is imported into SQL Server via an existing SSIS package. I need to make a change to the package to accommodate a new field in the flat file. The new field is a date field which is in the format dd-mmm-yy (e.g. 25-AUG-11 ). The date field in the flat file will either be empty (e.g. a space/whitespace) or populated with a date. I don’t have any control over the date format in the flat file. I need to import the date field in the flat file into an existing SQL Server

How to compare just the date, not the timestamp using LINQ

我与影子孤独终老i 提交于 2019-12-20 06:32:12
问题 I'm trying to compare just the date of a column but because the query below is also comparing the time I get no result set back. How could I write this same LINQ query if I'm only interested in the actual date value matching? The column "ImportDate" has a value that looks similar to this 2009-08-30 12:26:00 from t in UnitsOfWork _ where t.ImportDate = "08/30/2009" _ select t 回答1: You can compare it as a string or you can use just the Date property on ImportDate where t.ImportDate.ToString(

conversion of a varchar to a smalldatetime results in an out-of-range value

末鹿安然 提交于 2019-12-10 18:36:38
问题 The code: strSql = "insert into table2 (transactiondate) values ('" & transactiondate & "')" seems to be giving me the runtime error: The conversion of a varchar data type to a smalldatetime data type resulted in an out-of-range value In the code, strSql is a String object and transactiondate is a Date object. In the SQL database however, transactiondate is a smalldatetime object. I've tried changing the smalldatetime to a datetime (in the database) and I've tried transactiondate.toString()

How do I format dd-mmm-yy values in flat file to smalldatetime during data import?

不打扰是莪最后的温柔 提交于 2019-12-04 07:37:42
I have a flat file which is imported into SQL Server via an existing SSIS package. I need to make a change to the package to accommodate a new field in the flat file. The new field is a date field which is in the format dd-mmm-yy (e.g. 25-AUG-11 ). The date field in the flat file will either be empty (e.g. a space/whitespace) or populated with a date. I don’t have any control over the date format in the flat file. I need to import the date field in the flat file into an existing SQL Server table and the target field data type is smalldatetime. I was proposing to import the date as a string

How to select data from 30 days?

你离开我真会死。 提交于 2019-12-03 06:28:36
问题 I have query: SELECT name FROM ( SELECT name FROM Hist_answer WHERE id_city='34324' AND datetime >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) UNION ALL SELECT name FROM Hist_internet WHERE id_city='34324' AND datetime >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) ) x GROUP BY name ORDER BY name But DATE_SUB is a MySQL function and I need function for MsSQL 2008 Tell me please how to select data from 30 days by using MsSQL 2008? P.S.: Data type of datetime is smalldatetime 回答1: You should be

How to select data from 30 days?

对着背影说爱祢 提交于 2019-12-02 20:00:31
I have query: SELECT name FROM ( SELECT name FROM Hist_answer WHERE id_city='34324' AND datetime >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) UNION ALL SELECT name FROM Hist_internet WHERE id_city='34324' AND datetime >= DATE_SUB(CURRENT_DATE, INTERVAL 1 MONTH) ) x GROUP BY name ORDER BY name But DATE_SUB is a MySQL function and I need function for MsSQL 2008 Tell me please how to select data from 30 days by using MsSQL 2008? P.S.: Data type of datetime is smalldatetime You should be using DATEADD is Sql server so if try this simple select you will see the affect Select DATEADD(Month, -1,

How to compare just the date, not the timestamp using LINQ

北慕城南 提交于 2019-12-02 10:30:44
I'm trying to compare just the date of a column but because the query below is also comparing the time I get no result set back. How could I write this same LINQ query if I'm only interested in the actual date value matching? The column "ImportDate" has a value that looks similar to this 2009-08-30 12:26:00 from t in UnitsOfWork _ where t.ImportDate = "08/30/2009" _ select t You can compare it as a string or you can use just the Date property on ImportDate where t.ImportDate.ToString("yyyyMMdd") == "20090830" or where t.ImportDate.Date == new DateTime(2009,8,30) 来源: https://stackoverflow.com