Quantcast
Channel: ฟอรัม Getting started with SQL Server
Viewing all articles
Browse latest Browse all 8428

Date To Integer conversion problem

$
0
0

Hi there

I'm working on software for Pervasive-to-MS SQL migration.

There is a declaration

Declare :StDate DateTime;

Declare :ForDate DateTime;

The line

 Set :StDate = :StDate + (Truncate((:ForDate - :StDate) / 7, 0)) * 7;

goes without a hitch in the Pervasive. The same line

Set @StDate = @StDate + (Round((@ForDate - @StDate) / 7, 0)) * 7;

throws an Exception in MS SQL:

Implicit conversion from data type datetime to int is not allowed.
Use the CONVERT function to run this query.

I cannot change neither Pervasive nor MS SQL side manually. All I do is the Regular Expression translation of the code.

Any clue how to fix it with no tons of work?

Thanks.


Viewing all articles
Browse latest Browse all 8428

Trending Articles