Hello everybody i do have varchar column with DD-MM-YYYY. How can i convert
it to datetime data type ?
pls let me knowDo you need to jsut convert it within a query, you can use Cast of Convert
for that.
If you need to convert the column's data type, You have two options.
1) in T-SQL add the new column, do an update to move the data over, drop the
old column, then rename the new column
2) in Enterprise Manager change the data type and it will create a script
for you.
"mvp" <mvp@.discussions.microsoft.com> wrote in message
news:BAD8F615-56DF-47EB-93A7-26A8AC5C0920@.microsoft.com...
> Hello everybody i do have varchar column with DD-MM-YYYY. How can i
> convert
> it to datetime data type ?
> pls let me know
Showing posts with label pls. Show all posts
Showing posts with label pls. Show all posts
Thursday, March 29, 2012
Thursday, March 22, 2012
Date parameter 7 days in advance
can somebody pls help me with the formula for a datetime parameter that is
say 7 days past today. this will be used as the end date parameter.
my start_date parameter default is =(today)
thanksTry using SQL to create a dataset.
SELECT dateadd(day,7,getdate()) as end_date
I use dateadd like crazy.
"Tango" <Tango@.discussions.microsoft.com> wrote in message
news:Tango@.discussions.microsoft.com:
> can somebody pls help me with the formula for a datetime parameter that is
> say 7 days past today. this will be used as the end date parameter.
> my start_date parameter default is =(today)
> thanks|||Thanks John,
I tried adding this statement in the default value of the query & it didnt
work
I also copied your statement into the query string of a new dataset & get
error message 'minimum capacity must be non negative'
Todd
"John Geddes" wrote:
> Try using SQL to create a dataset.
> SELECT dateadd(day,7,getdate()) as end_date
> I use dateadd like crazy.
>
> "Tango" <Tango@.discussions.microsoft.com> wrote in message
> news:Tango@.discussions.microsoft.com:
> > can somebody pls help me with the formula for a datetime parameter that is
> >
> > say 7 days past today. this will be used as the end date parameter.
> >
> > my start_date parameter default is =(today)
> >
> > thanks
>
>|||undefined function 'getdate' in expression is the error message i get when i
run the query in the new dataset
"John Geddes" wrote:
> Put the statement in a new dataset.
> Then, go to the parameter and select default value from dataset, pick
> your new dataset, and then pick the column name.
> Did that help?
>
> "Tango" <Tango@.discussions.microsoft.com> wrote in message
> news:Tango@.discussions.microsoft.com:
> > Thanks John,
> >
> > I tried adding this statement in the default value of the query & it didnt
> >
> > work
> > I also copied your statement into the query string of a new dataset & get
> >
> > error message 'minimum capacity must be non negative'
> >
> > Todd
> >
> > "John Geddes" wrote:
> >
> > > Try using SQL to create a dataset.
> > >
> > > SELECT dateadd(day,7,getdate()) as end_date
> > >
> > > I use dateadd like crazy.
> > >
> > >
> > > "Tango" <Tango@.discussions.microsoft.com> wrote in message
> > > news:Tango@.discussions.microsoft.com:
> > > > can somebody pls help me with the formula for a datetime parameter
> > > > that is
> > > >
> > > > say 7 days past today. this will be used as the end date parameter.
> > > >
> > > > my start_date parameter default is =(today)
> > > >
> > > > thanks
> > >
> > >
> > >
>
>|||Thanks saglamtimur
i am now getting an error message 'doesnt have the expected type'
"saglamtimur" wrote:
> If you want vb.net solution I use this function for one week (7 days);
> =format(dateadd("ww",1,Globals!ExecutionTime),"dd/MM/yyyy")
> "ww" equals week, 1 equals 1 week, if you want further info just google
> "vb.net dateadd function"
> Hope helps.
> Regards
> "John Geddes" <john_g@.alamode.com> wrote in message
> news:#KqRU#h4EHA.3236@.TK2MSFTNGP15.phx.gbl...
> > Put the statement in a new dataset.
> >
> > Then, go to the parameter and select default value from dataset, pick
> > your new dataset, and then pick the column name.
> >
> > Did that help?
> >
> >
> > "Tango" <Tango@.discussions.microsoft.com> wrote in message
> > news:Tango@.discussions.microsoft.com:
> > > Thanks John,
> > >
> > > I tried adding this statement in the default value of the query & it
> didnt
> > >
> > > work
> > > I also copied your statement into the query string of a new dataset &
> get
> > >
> > > error message 'minimum capacity must be non negative'
> > >
> > > Todd
> > >
> > > "John Geddes" wrote:
> > >
> > > > Try using SQL to create a dataset.
> > > >
> > > > SELECT dateadd(day,7,getdate()) as end_date
> > > >
> > > > I use dateadd like crazy.
> > > >
> > > >
> > > > "Tango" <Tango@.discussions.microsoft.com> wrote in message
> > > > news:Tango@.discussions.microsoft.com:
> > > > > can somebody pls help me with the formula for a datetime parameter
> > > > > that is
> > > > >
> > > > > say 7 days past today. this will be used as the end date parameter.
> > > > >
> > > > > my start_date parameter default is =(today)
> > > > >
> > > > > thanks
> > > >
> > > >
> > > >
> >
> >
>
>|||Use expression (for seven days before):
=DateTime.Now.AddDays(-7)
Use expression (for seven days after):
=DateTime.Now.AddDays(7)
"Tango" wrote:
> can somebody pls help me with the formula for a datetime parameter that is
> say 7 days past today. this will be used as the end date parameter.
> my start_date parameter default is =(today)
> thanks|||Thank you soooo much sathya
works a charm
"sathya" wrote:
> Use expression (for seven days before):
> =DateTime.Now.AddDays(-7)
> Use expression (for seven days after):
> =DateTime.Now.AddDays(7)
>
> "Tango" wrote:
> > can somebody pls help me with the formula for a datetime parameter that is
> > say 7 days past today. this will be used as the end date parameter.
> >
> > my start_date parameter default is =(today)
> >
> > thanks|||How could this be done w/ a parameter?
=format(dateadd("mm",-1,parameters!stardate),"MMMM")
Thanks...
"saglamtimur" wrote:
> If you want vb.net solution I use this function for one week (7 days);
> =format(dateadd("ww",1,Globals!ExecutionTime),"dd/MM/yyyy")
> "ww" equals week, 1 equals 1 week, if you want further info just google
> "vb.net dateadd function"
> Hope helps.
> Regards
> "John Geddes" <john_g@.alamode.com> wrote in message
> news:#KqRU#h4EHA.3236@.TK2MSFTNGP15.phx.gbl...
> > Put the statement in a new dataset.
> >
> > Then, go to the parameter and select default value from dataset, pick
> > your new dataset, and then pick the column name.
> >
> > Did that help?
> >
> >
> > "Tango" <Tango@.discussions.microsoft.com> wrote in message
> > news:Tango@.discussions.microsoft.com:
> > > Thanks John,
> > >
> > > I tried adding this statement in the default value of the query & it
> didnt
> > >
> > > work
> > > I also copied your statement into the query string of a new dataset &
> get
> > >
> > > error message 'minimum capacity must be non negative'
> > >
> > > Todd
> > >
> > > "John Geddes" wrote:
> > >
> > > > Try using SQL to create a dataset.
> > > >
> > > > SELECT dateadd(day,7,getdate()) as end_date
> > > >
> > > > I use dateadd like crazy.
> > > >
> > > >
> > > > "Tango" <Tango@.discussions.microsoft.com> wrote in message
> > > > news:Tango@.discussions.microsoft.com:
> > > > > can somebody pls help me with the formula for a datetime parameter
> > > > > that is
> > > > >
> > > > > say 7 days past today. this will be used as the end date parameter.
> > > > >
> > > > > my start_date parameter default is =(today)
> > > > >
> > > > > thanks
> > > >
> > > >
> > > >
> >
> >
>
>|||would it be safe to assume that you could insert the starting date parameter
instead of now. so the second date (end date) is x days after the starting
date'
"sathya" wrote:
> Use expression (for seven days before):
> =DateTime.Now.AddDays(-7)
> Use expression (for seven days after):
> =DateTime.Now.AddDays(7)
>
> "Tango" wrote:
> > can somebody pls help me with the formula for a datetime parameter that is
> > say 7 days past today. this will be used as the end date parameter.
> >
> > my start_date parameter default is =(today)
> >
> > thanks|||Hi Ben,
I have just wrote a solution for your previous post.
saglamtimur
"Tango" <Tango@.discussions.microsoft.com> wrote in message
news:CA9238B4-5E65-417A-89D8-F70FBD8610A8@.microsoft.com...
> would it be safe to assume that you could insert the starting date
parameter
> instead of now. so the second date (end date) is x days after the starting
> date'
> "sathya" wrote:
> > Use expression (for seven days before):
> > =DateTime.Now.AddDays(-7)
> > Use expression (for seven days after):
> > =DateTime.Now.AddDays(7)
> >
> >
> > "Tango" wrote:
> >
> > > can somebody pls help me with the formula for a datetime parameter
that is
> > > say 7 days past today. this will be used as the end date parameter.
> > >
> > > my start_date parameter default is =(today)
> > >
> > > thanks|||Here's the formula...
=CDate(Parameters!startdate.Value).AddMonths(-1).ToString("MMMM")
"saglamtimur" wrote:
> Hi Ben,
> I have just wrote a solution for your previous post.
> saglamtimur
> "Tango" <Tango@.discussions.microsoft.com> wrote in message
> news:CA9238B4-5E65-417A-89D8-F70FBD8610A8@.microsoft.com...
> > would it be safe to assume that you could insert the starting date
> parameter
> > instead of now. so the second date (end date) is x days after the starting
> > date'
> >
> > "sathya" wrote:
> >
> > > Use expression (for seven days before):
> > > =DateTime.Now.AddDays(-7)
> > > Use expression (for seven days after):
> > > =DateTime.Now.AddDays(7)
> > >
> > >
> > > "Tango" wrote:
> > >
> > > > can somebody pls help me with the formula for a datetime parameter
> that is
> > > > say 7 days past today. this will be used as the end date parameter.
> > > >
> > > > my start_date parameter default is =(today)
> > > >
> > > > thanks
>
>sql
say 7 days past today. this will be used as the end date parameter.
my start_date parameter default is =(today)
thanksTry using SQL to create a dataset.
SELECT dateadd(day,7,getdate()) as end_date
I use dateadd like crazy.
"Tango" <Tango@.discussions.microsoft.com> wrote in message
news:Tango@.discussions.microsoft.com:
> can somebody pls help me with the formula for a datetime parameter that is
> say 7 days past today. this will be used as the end date parameter.
> my start_date parameter default is =(today)
> thanks|||Thanks John,
I tried adding this statement in the default value of the query & it didnt
work
I also copied your statement into the query string of a new dataset & get
error message 'minimum capacity must be non negative'
Todd
"John Geddes" wrote:
> Try using SQL to create a dataset.
> SELECT dateadd(day,7,getdate()) as end_date
> I use dateadd like crazy.
>
> "Tango" <Tango@.discussions.microsoft.com> wrote in message
> news:Tango@.discussions.microsoft.com:
> > can somebody pls help me with the formula for a datetime parameter that is
> >
> > say 7 days past today. this will be used as the end date parameter.
> >
> > my start_date parameter default is =(today)
> >
> > thanks
>
>|||undefined function 'getdate' in expression is the error message i get when i
run the query in the new dataset
"John Geddes" wrote:
> Put the statement in a new dataset.
> Then, go to the parameter and select default value from dataset, pick
> your new dataset, and then pick the column name.
> Did that help?
>
> "Tango" <Tango@.discussions.microsoft.com> wrote in message
> news:Tango@.discussions.microsoft.com:
> > Thanks John,
> >
> > I tried adding this statement in the default value of the query & it didnt
> >
> > work
> > I also copied your statement into the query string of a new dataset & get
> >
> > error message 'minimum capacity must be non negative'
> >
> > Todd
> >
> > "John Geddes" wrote:
> >
> > > Try using SQL to create a dataset.
> > >
> > > SELECT dateadd(day,7,getdate()) as end_date
> > >
> > > I use dateadd like crazy.
> > >
> > >
> > > "Tango" <Tango@.discussions.microsoft.com> wrote in message
> > > news:Tango@.discussions.microsoft.com:
> > > > can somebody pls help me with the formula for a datetime parameter
> > > > that is
> > > >
> > > > say 7 days past today. this will be used as the end date parameter.
> > > >
> > > > my start_date parameter default is =(today)
> > > >
> > > > thanks
> > >
> > >
> > >
>
>|||Thanks saglamtimur
i am now getting an error message 'doesnt have the expected type'
"saglamtimur" wrote:
> If you want vb.net solution I use this function for one week (7 days);
> =format(dateadd("ww",1,Globals!ExecutionTime),"dd/MM/yyyy")
> "ww" equals week, 1 equals 1 week, if you want further info just google
> "vb.net dateadd function"
> Hope helps.
> Regards
> "John Geddes" <john_g@.alamode.com> wrote in message
> news:#KqRU#h4EHA.3236@.TK2MSFTNGP15.phx.gbl...
> > Put the statement in a new dataset.
> >
> > Then, go to the parameter and select default value from dataset, pick
> > your new dataset, and then pick the column name.
> >
> > Did that help?
> >
> >
> > "Tango" <Tango@.discussions.microsoft.com> wrote in message
> > news:Tango@.discussions.microsoft.com:
> > > Thanks John,
> > >
> > > I tried adding this statement in the default value of the query & it
> didnt
> > >
> > > work
> > > I also copied your statement into the query string of a new dataset &
> get
> > >
> > > error message 'minimum capacity must be non negative'
> > >
> > > Todd
> > >
> > > "John Geddes" wrote:
> > >
> > > > Try using SQL to create a dataset.
> > > >
> > > > SELECT dateadd(day,7,getdate()) as end_date
> > > >
> > > > I use dateadd like crazy.
> > > >
> > > >
> > > > "Tango" <Tango@.discussions.microsoft.com> wrote in message
> > > > news:Tango@.discussions.microsoft.com:
> > > > > can somebody pls help me with the formula for a datetime parameter
> > > > > that is
> > > > >
> > > > > say 7 days past today. this will be used as the end date parameter.
> > > > >
> > > > > my start_date parameter default is =(today)
> > > > >
> > > > > thanks
> > > >
> > > >
> > > >
> >
> >
>
>|||Use expression (for seven days before):
=DateTime.Now.AddDays(-7)
Use expression (for seven days after):
=DateTime.Now.AddDays(7)
"Tango" wrote:
> can somebody pls help me with the formula for a datetime parameter that is
> say 7 days past today. this will be used as the end date parameter.
> my start_date parameter default is =(today)
> thanks|||Thank you soooo much sathya
works a charm
"sathya" wrote:
> Use expression (for seven days before):
> =DateTime.Now.AddDays(-7)
> Use expression (for seven days after):
> =DateTime.Now.AddDays(7)
>
> "Tango" wrote:
> > can somebody pls help me with the formula for a datetime parameter that is
> > say 7 days past today. this will be used as the end date parameter.
> >
> > my start_date parameter default is =(today)
> >
> > thanks|||How could this be done w/ a parameter?
=format(dateadd("mm",-1,parameters!stardate),"MMMM")
Thanks...
"saglamtimur" wrote:
> If you want vb.net solution I use this function for one week (7 days);
> =format(dateadd("ww",1,Globals!ExecutionTime),"dd/MM/yyyy")
> "ww" equals week, 1 equals 1 week, if you want further info just google
> "vb.net dateadd function"
> Hope helps.
> Regards
> "John Geddes" <john_g@.alamode.com> wrote in message
> news:#KqRU#h4EHA.3236@.TK2MSFTNGP15.phx.gbl...
> > Put the statement in a new dataset.
> >
> > Then, go to the parameter and select default value from dataset, pick
> > your new dataset, and then pick the column name.
> >
> > Did that help?
> >
> >
> > "Tango" <Tango@.discussions.microsoft.com> wrote in message
> > news:Tango@.discussions.microsoft.com:
> > > Thanks John,
> > >
> > > I tried adding this statement in the default value of the query & it
> didnt
> > >
> > > work
> > > I also copied your statement into the query string of a new dataset &
> get
> > >
> > > error message 'minimum capacity must be non negative'
> > >
> > > Todd
> > >
> > > "John Geddes" wrote:
> > >
> > > > Try using SQL to create a dataset.
> > > >
> > > > SELECT dateadd(day,7,getdate()) as end_date
> > > >
> > > > I use dateadd like crazy.
> > > >
> > > >
> > > > "Tango" <Tango@.discussions.microsoft.com> wrote in message
> > > > news:Tango@.discussions.microsoft.com:
> > > > > can somebody pls help me with the formula for a datetime parameter
> > > > > that is
> > > > >
> > > > > say 7 days past today. this will be used as the end date parameter.
> > > > >
> > > > > my start_date parameter default is =(today)
> > > > >
> > > > > thanks
> > > >
> > > >
> > > >
> >
> >
>
>|||would it be safe to assume that you could insert the starting date parameter
instead of now. so the second date (end date) is x days after the starting
date'
"sathya" wrote:
> Use expression (for seven days before):
> =DateTime.Now.AddDays(-7)
> Use expression (for seven days after):
> =DateTime.Now.AddDays(7)
>
> "Tango" wrote:
> > can somebody pls help me with the formula for a datetime parameter that is
> > say 7 days past today. this will be used as the end date parameter.
> >
> > my start_date parameter default is =(today)
> >
> > thanks|||Hi Ben,
I have just wrote a solution for your previous post.
saglamtimur
"Tango" <Tango@.discussions.microsoft.com> wrote in message
news:CA9238B4-5E65-417A-89D8-F70FBD8610A8@.microsoft.com...
> would it be safe to assume that you could insert the starting date
parameter
> instead of now. so the second date (end date) is x days after the starting
> date'
> "sathya" wrote:
> > Use expression (for seven days before):
> > =DateTime.Now.AddDays(-7)
> > Use expression (for seven days after):
> > =DateTime.Now.AddDays(7)
> >
> >
> > "Tango" wrote:
> >
> > > can somebody pls help me with the formula for a datetime parameter
that is
> > > say 7 days past today. this will be used as the end date parameter.
> > >
> > > my start_date parameter default is =(today)
> > >
> > > thanks|||Here's the formula...
=CDate(Parameters!startdate.Value).AddMonths(-1).ToString("MMMM")
"saglamtimur" wrote:
> Hi Ben,
> I have just wrote a solution for your previous post.
> saglamtimur
> "Tango" <Tango@.discussions.microsoft.com> wrote in message
> news:CA9238B4-5E65-417A-89D8-F70FBD8610A8@.microsoft.com...
> > would it be safe to assume that you could insert the starting date
> parameter
> > instead of now. so the second date (end date) is x days after the starting
> > date'
> >
> > "sathya" wrote:
> >
> > > Use expression (for seven days before):
> > > =DateTime.Now.AddDays(-7)
> > > Use expression (for seven days after):
> > > =DateTime.Now.AddDays(7)
> > >
> > >
> > > "Tango" wrote:
> > >
> > > > can somebody pls help me with the formula for a datetime parameter
> that is
> > > > say 7 days past today. this will be used as the end date parameter.
> > > >
> > > > my start_date parameter default is =(today)
> > > >
> > > > thanks
>
>sql
Subscribe to:
Posts (Atom)