Wrox Programmer Forums
Go Back   Wrox Programmer Forums > SQL Server > SQL Server 2000 > SQL Server 2000
|
SQL Server 2000 General discussion of Microsoft SQL Server -- for topics that don't fit in one of the more specific SQL Server forums. version 2000 only. There's a new forum for SQL Server 2005.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the SQL Server 2000 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old February 2nd, 2006, 08:52 AM
Registered User
 
Join Date: Jan 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default more nodes to b retrived if change in data

hi can some one say.. if i add more values as child this fuction is not working.. can u modify so that it works for any modification in child nodes

create function rtn(@uid int)
returns @output table(userid bigint,roleid bigint)
as
begin
    declare @rid int,@pid int
    select @rid = ( select roleid from usermaster where userid =@userid)
    select @pid = ( select positionid from usermaster where userid=@userid)

    if @rid=2
    begin
        insert @output
        select userid,roleid from usermaster
        where roleid in(select roleid from rolemaster where parentroleid=
        (select roleid from rolemaster where parentroleid=@rid))
        and
        positionid in
        (select positionid from positionmaster where parentpositionid in
        (select positionid from positionmaster where parentpositionid=@pid))
    end
    if @rid>2
    begin
        insert @output
        select userid, roleid from usermaster where userid in
        (select positionid from positionmaster where parentpositionid = @uid)
    end
return
end
Thanz in adv
ali





Similar Threads
Thread Thread Starter Forum Replies Last Post
using reflection save retrived data in xml file Baby_programmer C# 2005 2 November 26th, 2007 05:34 AM
how to change the case of data in data list while nittin14 ASP.NET 1.0 and 1.1 Basics 3 April 24th, 2007 03:58 AM
Transform data does not change Vince.Stanzione XSLT 0 September 22nd, 2005 12:01 PM
change data type to date kherboon Access 2 July 29th, 2003 10:33 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.