Re: Dinamyc Function
- From: Erland Sommarskog <esquel@xxxxxxxxxxxxx>
- Date: Mon, 20 Aug 2007 14:48:17 +0000 (UTC)
aCe (acerahmat@xxxxxxxxx) writes:
i want to make a FN that can check record exist or not.
this is my FN:
CREATE FUNCTION ufnCheckExists(
...
error msg :
Msg 1087, Level 15, State 2, Procedure ufnCheckExists, Line 25
Must declare the table variable "@table".
is it possible to create it. or any suggestion.
my purpose to create this, is i can reuse my function without creating
ambiguous function.
Simply forget it. This is T-SQL, this is not C#. While code reuse is a
virtue in T-SQL, it is not as big virtue as in an traditional programming
langauge. Specifically, it's very rarely a good idea to parameterise on
the table name.
For a longer discussion on dynamic SQL, see this article on my web
site: http://www.sommarskog.se/dynamic_sql.html.
--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.
- References:
- Dinamyc Function
- From: aCe
- Dinamyc Function
- Prev by Date: Re: Copy data from one table to another table with change in identity column values
- Next by Date: Re: TABLESAMPLE question
- Previous by thread: Dinamyc Function
- Next by thread: Re: Dinamyc Function
- Index(es):
Relevant Pages
|
Loading