473,651 Members | 2,670 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

default schema resolution for user-defined functions?

aj
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

Why?

Is default schema not considered in user-defined function name
resolution?

TIA

aj
Oct 29 '08 #1
2 3755
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
http://www.SQLStudio.com
Oct 29 '08 #2
aj (ro****@mcdonal ds.com) writes:
But this apparently won't work:
select blah,foo() from bar

Why?

Is default schema not considered in user-defined function name
resolution?
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

0
1572
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
55
4978
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 a different environment, and I am surprised to find that its default for serif is Times 16 and
4
19358
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
7
21332
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 prefix. (I use IBM Ole DB Data provider in the connection string). The access is currently set up...
1
11240
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?
12
8553
by: Plop69 | last post by:
need some help on following: xml file 1 <TEST xmlns="http://test" > <OK>mlkddflmkj</OK> </TEST>
0
1545
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 these tables in.
0
1528
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:
1
4602
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.
4
17264
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
0
8352
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8697
jinu1996
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 captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8579
tracyyun
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7297
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6158
isladogs
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 instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4144
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4283
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2699
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
2
1587
bsmnconsultancy
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.