Friday, January 27, 2012

!

Dear all,

I was given a project to transfer our database into sql server database.

In our previous database we used the datatype int4 for some columns to create some views and in some queries that we used to build our datawindows. In SQLServer 2000 i created a user defined function named int4. I can execute it with the line select dbo.int4(poso) from employee .

Unfortrunately this way make me to rebuild all my datawindows and replace int4( with dbo.int4( . Is there any way to execute queries using user defined function but omitting the first part name dbo. I mean to manage execute the command select int4(poso) from employee \\let int4 be a user definded function.

If i create an ODBC function i must use select fn int4(poso) from employee

I thing i could solve this if i could create a system function int4() but i have no idea how it can be done.

If i can’t solve this, i thing it will decided than is impossible to move to sqlserver Database. Has anyone any suggestions?

Thanks in advance,

Best regards,

In SQL Server, you are not allowed to create a system functions. There is no other choice. You have to use the dbo.int4().

But I am not sure what you are doing inside this function. How important it is. If it is permanent for all the query call, better update the values on the main table itself (using update statement) & take care while inserting these values.

|||

No, you will have to use the owner /schema prefix for the new defined function.

Jens K. Suessmeyer

http://www.sqlserver2005.de

|||

Hellen, please do not multipost.

Jens K. Suessmeyer

http://www.sqlserver2005.de

|||

Firstly many thanks for your reply!!!

As i said, i want to create this function so as not to change at all the code of our programs. Inside the code we use select statements and we use in a lot of points int4(). It is necessary as i have functions that i use to my database and i want to have the optional to use sqlserver database without changing at all my code.

As you said it is not possible in Sql Server as i am not allowed to create system functions. Is it possible inSql Server 2005 or 2008 to create system functions?

Any ideas of how i could create an odbc function but include the function in a select statement without the fn prefix? Or should i abandon the idea of moving to a strong database?

|||

No, this is not possible as far as I know. You should consider trying to change the code logic to support this (strong9 syntax :-)

Jens K. Suessmeyer

http://www.sqlserver2005.de

No comments:

Post a Comment