Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!news.swapon.de!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Erland Sommarskog Newsgroups: comp.databases.ms-sqlserver Subject: Re: Help for SQLServer Session Specific Global Variable Date: Mon, 03 Oct 2011 23:14:42 +0200 Organization: Erland Sommarskog Lines: 17 Message-ID: References: <98153dbd-72d4-41da-8e97-fb3f6c1ff710@z19g2000vby.googlegroups.com> <9e865eee-7b71-45e9-a99c-58ded5bb81f3@y18g2000yqy.googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 8bit Injection-Info: mx04.eternal-september.org; posting-host="nBFDv6s1VJQDuF1w6hpX2A"; logging-data="8899"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19c5guGiN7sTlCpLfVKnCV4" User-Agent: Xnews/2006.08.24 Mime-proxy/2.1.c.0 (Win32) Cancel-Lock: sha1:n09YzfXS8Ws9c6ONz9W2tpcef9Y= Xref: x330-a1.tempe.blueboxinc.net comp.databases.ms-sqlserver:727 Ender Karada? (enkaradag@gmail.com) writes: > after that i created a view like "select ID,NAME from worker where > DEPTNO=GETMYSESSIONDEPTNO()" (GETMYSESSIONDEPTNO() is an sql function > that returns related DEPTNO value in history table) A word of warning: data access from user-defined functions can cause serious performance problem. This one looks innocent, but you should certainly be careful with using functions all over the place. -- Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se Links for SQL Server Books Online: SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx