I have a long script Teradata SQL in SQL Assistant 13.11 that has about 20 places where a date is used, each time I run it, I need to change the dates manually & want to name the Date at the Start & add the variable name instead of the date to save work (& mistakes).
One thing though, the date appears in both 'YYYY-MM-DD' & also 'YYYY-MM-DD HH:MM:SS' Format.
I don't mind if I have to create & change 2 variables at the start - one for each Format type as it would still be better.
Check the SQLA help topic "Parameterized Queries".
In SQL Assistant you can define a parameter and use it multiple times within a request.
select date '?dateparam', ...
where datecol between date '?dateparam' and date '?dateparam' + 3
Make shure Options - Query - "Allow use of Named Parameters in queries" is checked.
Exactly what I needed, Thanks
How do I add thanks on this site for your help?
Just one more question Dieter,
I read the Parameterised Queries stuff in the Help menu, checked the checkbox etc.
I cant see a place where I actually name a variable a certain date?
Did you mean add a Select query at the start of my script?
I just want to add a variable called ?date for example & add that to every line that I need a date for.
Can you clarify for me?
just you run the query (F5).
An input dialog will pop up where you key in the date.
Thanks but I want to allocate a variable value somewhere in SQL Assistant - example "Date_Month" & then add "?Date_Month" wherever the script needs date input.
I have about 20 places that need the date which I need to update each month.
Is this possible?