Hello,
I was wondering if there is a date function to determine a starting
date based on a @.EndDate
parameter. In other word, if my user chose an end date of 3/31/2006, I
want to get a start date of 4/1/2005.
I appreciate any suggestion.
Edgar J.You can use another query to provide a default for the second parameter
using the 1st as input.
If its sqlserver you can use (I may have syntax slightly wrong as Im
not looking this up now).
SELECT [StartDate] = dateadd(day, dateadd(year, @.EndDate, -1), 1)
In other words return just 1 row , 1 column with a date.
Use sqlserver dateadd function to subtract 1 year and again to add 1
day.
Edgar wrote:
> Hello,
> I was wondering if there is a date function to determine a starting
> date based on a @.EndDate
> parameter. In other word, if my user chose an end date of 3/31/2006, I
> want to get a start date of 4/1/2005.
> I appreciate any suggestion.
> Edgar J.
Showing posts with label extract. Show all posts
Showing posts with label extract. Show all posts
Monday, March 19, 2012
Sunday, February 19, 2012
Date Convertion
I am currently running a DTS package to extract data from a DB2 database.
The code reads Select * from ABC where entrydate='12/15/2005'
This works fine but I need to automate the process by selecting the date
automatically. As soon as the entrydate = formula the extract do not work.
I have tried different versions of date formula
The format of the date field on the SQL table is smalldatetime and on DB2
it is date
Can some one helpVuka
Use 'yyyymmdd' format with SQL Server
Lookup CONVERT system function in the BOL
"Vuka" <Vuka@.discussions.microsoft.com> wrote in message
news:CF33E355-6FFA-4C1F-95A8-C9EABE0CDD29@.microsoft.com...
>I am currently running a DTS package to extract data from a DB2 database.
> The code reads Select * from ABC where entrydate='12/15/2005'
> This works fine but I need to automate the process by selecting the date
> automatically. As soon as the entrydate = formula the extract do not
> work.
> I have tried different versions of date formula
> The format of the date field on the SQL table is smalldatetime and on DB2
> it is date
> Can some one help
The code reads Select * from ABC where entrydate='12/15/2005'
This works fine but I need to automate the process by selecting the date
automatically. As soon as the entrydate = formula the extract do not work.
I have tried different versions of date formula
The format of the date field on the SQL table is smalldatetime and on DB2
it is date
Can some one helpVuka
Use 'yyyymmdd' format with SQL Server
Lookup CONVERT system function in the BOL
"Vuka" <Vuka@.discussions.microsoft.com> wrote in message
news:CF33E355-6FFA-4C1F-95A8-C9EABE0CDD29@.microsoft.com...
>I am currently running a DTS package to extract data from a DB2 database.
> The code reads Select * from ABC where entrydate='12/15/2005'
> This works fine but I need to automate the process by selecting the date
> automatically. As soon as the entrydate = formula the extract do not
> work.
> I have tried different versions of date formula
> The format of the date field on the SQL table is smalldatetime and on DB2
> it is date
> Can some one help
Date Conversion
I'm trying to extract some data to files to insert into an
oracle table and I'm having difficulty in getting the date
formatted so that oracle can read it. How do I get a date
out of SQL Server so that it will conform to dd-mon-yyyy
and Oracle won't cough and sputter?
Don't know what Oracle will accept but you can use CONVERT() to format the
date into any kind of string you wish. Specifically the 130 option sounds
like what your after. Check out CONVERT() in BooksOnLine.
Andrew J. Kelly SQL MVP
"Ptaz" <ptaz@.comcast.net> wrote in message
news:1df3801c454a4$9da12550$a501280a@.phx.gbl...
> I'm trying to extract some data to files to insert into an
> oracle table and I'm having difficulty in getting the date
> formatted so that oracle can read it. How do I get a date
> out of SQL Server so that it will conform to dd-mon-yyyy
> and Oracle won't cough and sputter?
oracle table and I'm having difficulty in getting the date
formatted so that oracle can read it. How do I get a date
out of SQL Server so that it will conform to dd-mon-yyyy
and Oracle won't cough and sputter?
Don't know what Oracle will accept but you can use CONVERT() to format the
date into any kind of string you wish. Specifically the 130 option sounds
like what your after. Check out CONVERT() in BooksOnLine.
Andrew J. Kelly SQL MVP
"Ptaz" <ptaz@.comcast.net> wrote in message
news:1df3801c454a4$9da12550$a501280a@.phx.gbl...
> I'm trying to extract some data to files to insert into an
> oracle table and I'm having difficulty in getting the date
> formatted so that oracle can read it. How do I get a date
> out of SQL Server so that it will conform to dd-mon-yyyy
> and Oracle won't cough and sputter?
Labels:
anoracle,
conversion,
database,
date,
dateformatted,
difficulty,
extract,
files,
insert,
microsoft,
mysql,
oracle,
server,
sql,
table
Subscribe to:
Posts (Atom)