Showing posts with label own. Show all posts
Showing posts with label own. Show all posts

Friday, February 24, 2012

How can I use MDX functions in SQL Query Analyzer (Client Tool)

I'm very new to using MS-SQL stuffs and the IT dept here doesn't have any
DBMA to speak of. Thus, I'm a bit on my own - except for you helpful
people...
I just installed the Client Tools on my workstation and tried a simple query:
SELECT IIf(TBL.fld is NULL, "-N/A-", TBL.fld) FROM TBL;
and get the following error message:
Server: Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'is'.
According to the help files, this should work, but clearly not. Is there
something(s) I need to enable, install, configure, tweek, activate, cajole,
or otherwise beg into acquiesence?
See reply in microsoft.public.sqlserver.setup
HTH
Jasper Smith (SQL Server MVP)
http://www.sqldbatips.com
I support PASS - the definitive, global
community for SQL Server professionals -
http://www.sqlpass.org
"slintz" <slintz@.discussions.microsoft.com> wrote in message
news:A2D102C1-1023-413A-94D3-B82440DB08EC@.microsoft.com...
> I'm very new to using MS-SQL stuffs and the IT dept here doesn't have any
> DBMA to speak of. Thus, I'm a bit on my own - except for you helpful
> people...
> I just installed the Client Tools on my workstation and tried a simple
> query:
> SELECT IIf(TBL.fld is NULL, "-N/A-", TBL.fld) FROM TBL;
> and get the following error message:
> Server: Msg 156, Level 15, State 1, Line 1
> Incorrect syntax near the keyword 'is'.
>
> According to the help files, this should work, but clearly not. Is there
> something(s) I need to enable, install, configure, tweek, activate,
> cajole,
> or otherwise beg into acquiesence?
>

How can i use default schemas of users in a function ?

Hi,

I've a Problem with a Function called by different users.

I want the different callers to query a table in their own default Schema.

So if i refence the full Path [Schema].[Tablename] it works Properly.

If i just Use the [Tablename] for reference it fails.

The function was created with EXECUTE AS CALLER option ;

if I call it with dynamic SQL i retreive the error-message

"Only functions and extended stored procedures can be executed from within a function."

does anybody know a solution for this problem?

thanks in advance

Raimund

Raimund wrote:

So if i refence the full Path [Schema].[Tablename] it works Properly.

If i just Use the [Tablename] for reference it fails.

The function was created with EXECUTE AS CALLER option ;

I quote from Books Online (search for "Object Visibility and Qualification Rules")

"

USE DBY SELECT * FROM DBY..TableX

Because LoginX is associated with UserA in DBY, SQL Server first looks for DBY.UserA.TableX. If there is no table with this name, SQL Server looks for a table DBY.dbo.TableX. "

So engine look for [yourCallerUser].[Tablename] and for [dbo].[Tablename] and find no [Tablename]

Then I think you have to maintain full path [Schema].[Tablename] to objects reference.

|||

Hm,

so i guess i have to path the query-results by parameter to the function.

It looks horrible but it works.

Best Regards

Raimund