smalldatetime

How do I convert an SQL Server SMALLDATETIME to a Unix timestamp?

How do I convert an SQL Server SMALLDATETIME to Unix Timestamp? date was stored as CAST(0x96040474 AS SmallDateTime) in MS Access DB. Data was dumped to SQL and I'm looking to convert those times to Unix Timestamps for MySQL. Thanks AO ...

Tsql VarChar implicitly to SmallDateTime

When executing the following using a smalldatetime constraint on the returned results, I get zero results: Execute sp_proc @DateOfBirth = '01/01/1900' or Execute sp_proc @DateOfBirth = '1900-01-01' But when using the following varchar argument all the sudden i get results which correspond to 1 Jan 2000. Does smalldatetime imp...

Asp.net to SQL Server 2005, UPDATE smalldatetime procedure doesn't work?

As the topic suggests. I'm making a small program where you can browse and handle a bunch of data. The problem is that while inserting new rows into the SQL table works fine, using the same methods to update causes a problem with the smalldatetime variables. I noticed using profiler that the exec command puts double quotes on the dates,...

SQL Server programming - update all dates by a given number of days

I have a demo database with a couple of hundred tables in it. Each table usually has at least one field named tstamp which is a smalldatetime datatype. Some tables have other datefields too. Many tables also have 1 or more triggers on them. I wrote a script (the hard way - see below) to increment the date fields in each table by a given...

Unable to inject smalldatetime into D-SQL statement

Hi, when i try to execute this sql statement i am getting the error.. Conversion failed when converting character string to smalldatetime data type. Does anyone know what i am doing wrong? declare @modality varchar(50) declare @datefrom smalldatetime set @modality = 'xxxxxxx' set @datefrom = '20090101' declare @var1 nvarchar(4000) se...

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

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 h...

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

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 _ whe...

datetime vs smalldatetime

If I don't care about less than seconds, what should be the recommended type to store my datetime values in sql-server 2005, is it datetime or smalldatetime or else? ...

SQL Server 2005: converting smalldatetime to varchar behaves differently in view and 'normal' query

Hi, I have a view that basically just returns all records from a table, and adds a column 'isodate' which is supposed to be the date in ISO-Format. CREATE VIEW [dbo].[v_bedarfe] AS SELECT *,convert(varchar(16),datum,20) As isodat FROM bedarfe GO The "datum"-field is smalldatetime. The results of a query on isodat were...'surprisi...

check for null date in CASE statement, where have I gone wrong?

Hello, My source table looks like this Id StartDate 1 (null) 2 12/12/2009 3 10/10/2009 I want to create a select statement, that selects the above, but also has an additional column to display a varchar if the date is not null such as : Id StartDate StartDateStatus 1 (null) Awaiting 2 12/12...

Convert varchar colum to smalldatetime

I have a table with 800+ records. In this table I have a column named 'Data' of varchar (10) datatype which contains dates in 'dd.MM.yyyy' format.I want to convert it to smalldatetime. I've tried converting it using Enterprise Management Studio Express, but I receive this error: 'The conversion of char data type to smalldatetime data t...