Showing posts with label datetime. Show all posts
Showing posts with label datetime. Show all posts

Wednesday, March 7, 2012

Assign a value to a variable without using SQL Task

Greetings once again,

I am trying to achieve a seemingly simple task of assigning datetime value to a user variable at the point my package starts running. How can I do this without using a SQL Script Task? Should I be using a script task for this or is there a simpler way to achieving the same thing?

Thanks in advance.

There are a couple System variable that might have have what you are looking for: StartTime and ContainerStartTime. To see them go to variables and click in the gray icon with the X.|||

Hi Rafael,

Yes thank you. I am now using the System variable StartTime which is the start time of the package when it's run.

That's perfect!

Saturday, February 25, 2012

aspx, mssql and datetime

Hi, i am trying to retrive some datetime set from the database (2 posts in this table), senastposted is a datetime field.
when i run:
SELECT senastposted FROM ftp WHERE senastposted <= 2005-10-28
i get this result:

senastposted
0 record(s) affected.


and when i run:
SELECT senastposted FROM ftp WHERE senastposted >= 2005-10-28
i get this result:

senastposted
25-10-2005
29-10-2005
2 record(s) affected.
what i want is to retrive the first value based on the date:
25-10-2005
any idea why SELECT senastposted FROM ftp WHERE senastposted <= 2005-10-28 dosent work?
( i have tried to change the dates to 28-10-2005 and 28/10-2005)

Hello Pafo,
You might try something similar to this:
<code>
SELECT DATE_FORMAT(datetime,'%d/%m/%Y') AS dt WHERE ...
</code>

|||you might want to actually ask a question here.
|||Please excuse the earlier comment. When i clicked the link the text of the message was a single period.
Most DBMS systems use proprietary extentions for dealing withdates. Stuff like 'before' or 'after'. look up dateoperations in SqlServer.