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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-06-03 : 08:23:28
|
| Bhaggs writes "Hi,I have been doing pl-sql programming using oracle for last 3 years and have recently started working on Transact SQL programming.I want to replicate following scenario as seen in oracle.Usign Oracle(This is a simple example):Select Emp.Emp_Code,Emp.sal, Oracle_Function('Emp_Personal','Status_Desc',Emp.status) "Status" from EmpNote: Emp_Personal is my another table having 'Salary' field.This can vary."Oracle_Function" is my Generic user defined function which returns a VARCHAR Output based on Dynamic SQL generated.Eg: Select Status_Desc from Emp_Personal Where Status = @ParameterMy output is as under:Emp_Code Sal Status100 1200 Is not Valid200 2100 Is Valid300 2300 Is Valid400 800 Is not ValidNow, I want to do the same thing in sql server.I tried using dynamic sql in functions but somehow I can simulate above scenario.Need help uergently.Regards,BSM" |
|
|
mtomeo
Starting Member
30 Posts |
Posted - 2003-06-03 : 11:01:03
|
| Look up "User Defined Functions" in BOL. SQL Server supports UDF's also. Just as in Oracle, once you create the UDF, you can use it the same way...the same way you would use any System Defined Function. Basically, assuming you've created the UDF correctly, your syntax is the same as Oracle when you need to reference it.It sounds like you need help replicating your Oracle UDF in SQL Server. Post your Oracle function if you need help re-writing that in Transact-SQL. |
 |
|
|
|
|
|