There are no variables outside of SPs in Teradata.But there are parameters for macros, and if it's a script, you can use shell-variables in Unix.If you provide us with more details, maybe we can show you a workaround...Dieter
Matt,Could you please post the T-SQL code, I am interested to learn how its working.ThanksStration
Hi Matt,looks like a part of a SP in T-SQL to have a parameterized view.In a lot of cases you can use a Teradata macro for that. No variables/loops/if but parameters.create macro blabla (startdate int, enddate int) as(SELECT 'CT' STATE,S.Blah APPLDATE,S.CMPLDATE,SUBSTR(S.Blahblah,1,1) ORDER_TYPE_CD,S.CUSTYPE1,S.YaddaYadda,S.DISCONNECT_REASON_CD DISCRSNFROM VNTV010_CRIS_SO_NUMBER SAND S.SERVICE_ORDER_APPLICATION_DT BETWEEN :startdateAND :enddateAND S.POSTDATE >= :startdate ;other DML stuff;);exec blabla(1060401, 1060431);Be carefull, a macro is always a multistatement (i.e. a single transaction), which might be positive (faster performance) or negative (e.g. huge transient journal if there are several inserts/deletes/updates)Dieter

First of all, I am new, and I am not sure where to post basic Teradata SQL questions.Anyway, outside of a SP, I am writing a long piece of code which I would like to use some variables in, but I can't seem to figure out how to declare a variable in Teradata SQL. Any ideas?