Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Inputbox using SQL..

Author  Topic 

spshanth
Starting Member

3 Posts

Posted - 2008-10-30 : 04:21:58
Hello All,

My requirement is to get the date from the user through an input box and to use the same in a query. But by default the inputbox shld have a value of curretnyear/01 (i;e) for this year it should be 2008/01 and for next year 2009/01.

can anyone help me in this?

Thanks in advance.
Prashanth.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-30 : 04:31:15
Is this for sql reports? if yes, set the value in default value box of parameter properties window as

=Cstr(YEAR(Now())) + '/01'
Go to Top of Page

spshanth
Starting Member

3 Posts

Posted - 2008-10-30 : 05:32:09
Thanks for the response. But it dint work . can you tell me how to assign the result of a query to a variable and then use the same varible in some other place? for example, consider the following query:

Select TO_CHAR(sysdate, 'YYYY')||'/01' from dual;

the o/p of this query will be 2008/01. i want to assign this o/p to a variable so that i can call that variable in some other place.
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-10-30 : 05:42:02
quote:
Originally posted by spshanth

Thanks for the response. But it dint work . can you tell me how to assign the result of a query to a variable and then use the same varible in some other place? for example, consider the following query:

Select TO_CHAR(sysdate, 'YYYY')||'/01' from dual;

the o/p of this query will be 2008/01. i want to assign this o/p to a variable so that i can call that variable in some other place.


aha...it seems like you're using Oracle. what i gave was SQL Server syntax as this is SQL Server forum. please post in some oracle forums like www.dbforums.com if you need oracle related syntax
Go to Top of Page
   

- Advertisement -