Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
TajKazi
Posting Yak Master
101 Posts |
Posted - 2014-11-07 : 07:12:19
|
please tell me how to write following query in ms sql server.. specially "connect by prior" and "start with"here it is query.. select count(*) into v_is_manager from custom.ESS_USERS eu where eue.IS_ACTIVE = 'Y' connect by prior eue.PERSONID = eue.supervisor_personid start with eue.supervisor_personid = p_person_id; |
|
TajKazi
Posting Yak Master
101 Posts |
Posted - 2014-11-07 : 07:50:13
|
also how to write following in sql server please anybody guide me............querySelect := querySelect || ' SELECT * FROM RNR_VW_ALLREPORTDATA WHERE 1 = 1 ' ; if((p_from is not null) and (p_to is not null)) then querySelect := querySelect || ' and (NOMINATED_FOR >= '|| '''' || p_from || '''' ||' and NOMINATED_FOR <= '|| '''' || p_to ||'''' ||') ';end if; |
|
|
Ifor
Aged Yak Warrior
700 Posts |
Posted - 2014-11-07 : 12:55:52
|
To get any decent replies you will have to take the time to provide consumable sample data with the expected results.Query1The equivalent of CONNECT BY is a recursive CTE.Query2Variables start with @, so @queryselect, @p_from etcString concatination uses + not ||.IF ... END IF becomes IF BEGIN ... END |
|
|
|
|
|