Skip to Content
author's profile photo Former Member
Former Member

want to convert function in SQL Server 2000

Hi ,

i am writing this function in oracle.Could you please convert this function in SQL Server 2000 because i am new in this and dont know how to use decode function in sql.

Please following is the code for oracle.

CREATE OR REPLACE function fun ( localex varchar2,titlex varchar2)

return number

as x number;

begin

select sum ( decode (count (username),max(prereq_count),1,0) ) x into x from

(

SELECT

prereq_count,

username

FROM

table1

)

group by username ;

return x;

end fun;

/

Regards

Vishal

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Mar 20, 2009 at 07:07 AM

    Just take a look example below might give you idea :

    create or replace function f_makeAddress_tx (
    i_address_tx VARCHAR2,
    i_city_tx VARCHAR2,
    i_state_tx VARCHAR2,
    i_zip_tx VARCHAR2)
    return VARCHAR2
    is
    e_badZip EXCEPTION; u279E8
    pragma EXCEPTION_init(e_badZip,-20998); u279E9
    v_out_tx VARCHAR2(256);
    begin
    p_validateZip (i_zip_tx); u279E12
    v_out_tx:= i_address_tx||u2019, u2018|| u279E13
    i_city_tx ||u2019, u2018||
    i_state_tx ||u2019, u2018||
    i_zip_tx;
    return v_out_tx; u279E17
    exception
    when e_badZip then u279E19
    return i_zip_tx || u2018: Invalid zip code.u2019;
    end;

    Regards,

    Clint

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.