Getting Started with Adobe After Effects - Part 6: Motion Blur


Upload Image Close it
Select File

Browse by Tags · View All
sql_server 217
t-sql 211
tsql 116
sqlserver 96
BRH 78
#SQLServer 66
#TSQL 56
SQL Server 34
function 11
SSMS 9

Archive · View All
August 2007 17
August 2010 8
June 2012 7
June 2011 7
November 2007 7
August 2012 6
May 2012 6
November 2011 6
August 2011 6
October 2011 6

Madhivanan's TSQL Blog

Computed parameters in Stored Procedure

Apr 20 2012 12:00AM by Madhivanan   

Well. You are aware of Computed Columns in SQL Server. In a similar way you can also use Computed Parameters. Consider the following procedure.

Create procedure test
(
	@datetime datetime,
	@date date = @datetime
)
as
	select @datetime as date_with_time, @date as date_only
When you execute the procedure you get this result
EXEC '2001-10-18 12:45:22.000'
date_with_time          date_only
----------------------- ----------
2001-10-18 12:45:22.000 2001-10-18
As you see the parameter accepts the value supplied for @datetime and convert it to date datatype. 
When you supply value for @date, it will ignore the value of @datetime, the default value for it
EXEC '2001-10-18 12:45:22.000','2012-01-22 19:15:12.000'
date_with_time          date_only
----------------------- ----------
2001-10-18 12:45:22.000 2012-01-22
However it is not possible to use an expression for the computed paramters 
ie @date date=dateadd(day,10,@datetime) will not work. You should be aware of this when you use paramers
this way.

Tags: 


Madhivanan
3 · 39% · 12441
2 Readers said this post helped them to refresh memory
Nakul Vachhrajani said this post helped them to refresh memory on 4/24/2012 10:05:00 PM
Profile · Blog · Facebook · Twitter
Hardik Doshi said this post helped them to refresh memory on 6/24/2012 11:10:00 PM
Profile · Facebook
13
 
0
Lifesaver
 
2
Refreshed
 
 
0
Incorrect



Submit

4  Comments  

  • I guess this example is about the way to specify default value for parameter @date. You will get same result if you run this:

    EXEC test '2001-10-18 12:45:22.000', DEFAULT
    
    commented on Apr 24 2012 12:47AM
    Olga Medvedeva
    66 · 3% · 843
  • Used this many times myself, but never thought of it as a "computed parameter". Nice, different way of looking at it.

    commented on Apr 24 2012 10:06PM
    Nakul Vachhrajani
    4 · 33% · 10587
  • I found some error there..

    commented on Jun 25 2012 5:47AM
    kimmpaddle
    2895 · 0% · 2
  • kimmpaddle, what is the error?

    commented on Jun 25 2012 5:53AM
    Madhivanan
    3 · 39% · 12441

Your Comment


Sign Up or Login to post a comment.

"Computed parameters in Stored Procedure" rated 5 out of 5 by 13 readers
Computed parameters in Stored Procedure , 5.0 out of 5 based on 13 ratings
    Copyright © Rivera Informatic Private Ltd Contact us      Privacy Policy      Terms of use      Report Abuse      Advertising      [ZULU1097]