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

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 global function or parameter
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

rizo
Starting Member

United Kingdom
16 Posts

Posted - 11/21/2012 :  06:45:51  Show Profile  Reply with Quote
Hi guys,

is there a way of using global functions or paramenters in TSQL?
Simply I want it to do this like in Access.

SELECT *
FROM table1
WHERE (((table1.id)=current_productID1()));
this is achieved by creating a funtion in Access.

Is there a way to do this in TSQL?
This criteria filter will be used in different queries/views etc.
What is the feature I want that will do this?
thanks


rizo

webfred
Flowing Fount of Yak Knowledge

Germany
8781 Posts

Posted - 11/21/2012 :  07:14:55  Show Profile  Visit webfred's Homepage  Reply with Quote
See here: http://www.simple-talk.com/sql/t-sql-programming/sql-server-functions-the-basics/


Too old to Rock'n'Roll too young to die.
Go to Top of Page

rizo
Starting Member

United Kingdom
16 Posts

Posted - 11/21/2012 :  09:50:31  Show Profile  Reply with Quote
thanks for that but I dont think that is what I'm looking for.
This simply runs the same query every time yo call it doesnt it?.
I want to set up a function/variable and apply this as a filter/criteria.


rizo
Go to Top of Page

rizo
Starting Member

United Kingdom
16 Posts

Posted - 11/22/2012 :  05:42:51  Show Profile  Reply with Quote
anyhting?

rizo
Go to Top of Page
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.07 seconds. Powered By: Snitz Forums 2000