473,549 Members | 2,846 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

default schema resolution for user-defined functions?

SQL Server 2005 64-bit 9.00.3042 SP2

When I map a database user to a login, I can specify a default schema
for that user. After that, any SQL from that user w/o an explicit
schema will be resolved to that default schema.

I would like for this to happen in regards to user-defined functions
(in this case, a scalar-valued function). However, it looks as if
I must always explicitly specify the schema when using the function.

In other words: I have a function foo() and a table bar in schema
myschema. My default schema is myschema.

This works:
select blah from bar

And this works:
select blah,myschema.f oo() from bar

But this apparently won't work:
select blah,foo() from bar


Is default schema not considered in user-defined function name


Oct 29 '08 #1
2 3751
Scalar-valued functions must be invoked by using at least two part name
notation. Table-valued functions can be invoked only by name.

Plamen Ratchev
Oct 29 '08 #2
aj (ro****@mcdonal ds.com) writes:
But this apparently won't work:
select blah,foo() from bar


Is default schema not considered in user-defined function name
Correct. You must always specify the schema with scalar UDFs. This
permits Microsoft to add new scalar system functions in future releases
of SQL Server.
Erland Sommarskog, SQL Server MVP, es****@sommarsk og.se

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinf...ons/books.mspx

Oct 29 '08 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

by: inquirydog | last post by:
Hi- I am using xml to hold configuration data for a project, and using schema to define what the configuration file should look like. I wanted to get some advice on an intelligant way to specify and create a default config file. In other words, when the developer puts a new element in the schema
by: Haines Brown | last post by:
I've been setting font-size 1em; as the default in my style sheets. Until now, that seemed to be ok. But now I'm beginning to wonder. My aim is to have an easily readable, but not overly large text when the user uses the default font size in his browser and uses the typical display resolution. I did a reinstall of my friendly browser in...
by: Hemant Shah | last post by:
Folks, Is there a way to set a default schema name by setting environment variable, so that it is set for CLP and any program I run from command line. Thanks. -- Hemant Shah /"\ ASCII ribbon campaign
by: greatcanyon | last post by:
Hi, When I create a new user in DB2, can I set the default schema to an existing schema? The reason I want to do this is that I want to later connect to db2 as this user and access tables WITHOUT the schema name prefix. In addition to that, I want to use ADO.NET to connect as this user and query tables in another schema without the...
by: Nalaka | last post by:
Hi, We have a aps.net 2.0 web application and sqlserver 2005. We keep the connection string in the web.config file. We need to set the for the web application... so we do not have to hard code the default schema in every call. Is it possible to set default schema in the connection string?
by: Plop69 | last post by:
need some help on following: xml file 1 <TEST xmlns="http://test" > <OK>mlkddflmkj</OK> </TEST>
by: ChrisC | last post by:
Hi. I'm attempting to get DB2ADVIS to analyze some SQL that I have to determine if any MDC tables would be appropriate (well, at least to know what DB2 thinks). Unfortunately, I'm running into issues. My SQL is using unqualified tables (generated from a tool), and I'd like to be able to specify a specific schema that it should look for...
by: sancho | last post by:
Hi folks: My environment: db2level: "DB2 v8.1.0.48", "s040212", "MI00069", FixPak "5". db2licm -l: DB2 Enterprise Server Edition uname -a: Linux 2.6.17-1.2187_FC5smp My question:
by: aj | last post by:
==SQL Server 2005 SP2== Is it possible to set the default schema in code? I know that, for a particular DB user, I can set the default schema statically in Mgmt Studio. However, I want to do this dynamically in source code. I am using JDBC if that matters.
by: Dave Burns | last post by:
Hello, I am trying to specify a logical default value for a in a WCF Web Service using basicHttpBinding. I realize that the language defaults are: int - 0 string - null bool - false
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.