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 |
|
karthikeyanc
Starting Member
1 Post |
Posted - 2009-09-18 : 04:24:00
|
| hi folks, i have a follwing sp which i create in oracle but my client ask me to develop the same for ms sql server, since i have no idea about the sql server i need you peoples guidence to fullfill my client needs the code is as follows...CREATE OR REPLACE PROCEDURE validationASTYPE t_t1 is table of NUMBER(2);t_a t_t1;i NUMBER ; BEGIN select Count(table1.user_name) BULK COLLECT INTO t_afrom table1 ,table2where table1.user_name = table2.user_name;IF t_a(1)>0 THEN dbms_output.put_line('EXECUTION FAILS');ELSE dbms_output.put_line('SUCCESSFUL EXECUTION');END IF; END ;thanks in advance Karthikeyanc2003 |
|
|
TG
Master Smack Fu Yak Hacker
6065 Posts |
Posted - 2009-09-18 : 10:23:06
|
Well I don't know Oracle but it looks like this may be an sql server equivalent:if object_id('dbo.validation') > 0 drop proc dbo.validationgocreate proc dbo.validationasif exists ( select 0 from table1 t1 inner join table2 t2 on t2.[user_name] = t1.[user_name] )begin print 'EXECUTION FAILS'endelsebegin print 'SUCCESSFUL EXECUTION'endgoBe One with the OptimizerTG |
 |
|
|
|
|
|