dbTalk Databases Forums  

Help please: simple Enterprise Manager query

microsoft.public.sqlserver.clients microsoft.public.sqlserver.clients


Discuss Help please: simple Enterprise Manager query in the microsoft.public.sqlserver.clients forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
kvr901
 
Posts: n/a

Default Help please: simple Enterprise Manager query - 09-14-2005 , 11:00 AM






Hello,

I am new to SQL Server 2000, and trying to learn it.

I have a small practice table with 5 records. One field is called
"fldcustomerID" in which the customer records are numbered 1,2,3,4,5.

OPEN TABLE
Using Enterprise Manager when I right click the TABLE to open the table as a
query (using the graphical query thing) and put a "?" in the criteria box of
"fldcustomerID" I get this:
SELECT *, fldCustomerID AS Expr1
FROM tblCustomer
WHERE (fldCustomerID = ?)
The above pops us a dialog into which I type the customer ID I want and it
works fine.


NEW VIEW
If I try the same thing by creating a VIEW when I type a "?" into the
criteria box of the query designer I am presented with a message:
"'Parameters' cannot be used in this query type." The SQL the designer
creates is:
SELECT dbo.tblCustomer.*, fldCustomerID AS Expr1
FROM dbo.tblCustomer
WHERE (fldCustomerID = ?)
When I run this it works just like the first query, and works fine.


Why do I get the error message?
Why does the query work?

Thank you.

Reply With Quote
  #2  
Old   
Sue Hoegemeier
 
Posts: n/a

Default Re: Help please: simple Enterprise Manager query - 09-14-2005 , 07:49 PM






SQL Server doesn't support parameterized views. That's
basically what the error is telling you. You can have
parameters for SQL statements (like the query), stored
procedures or you can use table valued parameterized user
defined functions.
But you can't use parameters in views.

-Sue

On Wed, 14 Sep 2005 09:00:14 -0700, kvr901
<kvr901 (AT) discussions (DOT) microsoft.com> wrote:

Quote:
Hello,

I am new to SQL Server 2000, and trying to learn it.

I have a small practice table with 5 records. One field is called
"fldcustomerID" in which the customer records are numbered 1,2,3,4,5.

OPEN TABLE
Using Enterprise Manager when I right click the TABLE to open the table as a
query (using the graphical query thing) and put a "?" in the criteria box of
"fldcustomerID" I get this:
SELECT *, fldCustomerID AS Expr1
FROM tblCustomer
WHERE (fldCustomerID = ?)
The above pops us a dialog into which I type the customer ID I want and it
works fine.


NEW VIEW
If I try the same thing by creating a VIEW when I type a "?" into the
criteria box of the query designer I am presented with a message:
"'Parameters' cannot be used in this query type." The SQL the designer
creates is:
SELECT dbo.tblCustomer.*, fldCustomerID AS Expr1
FROM dbo.tblCustomer
WHERE (fldCustomerID = ?)
When I run this it works just like the first query, and works fine.


Why do I get the error message?
Why does the query work?

Thank you.


Reply With Quote
  #3  
Old   
kvr901
 
Posts: n/a

Default Re: Help please: simple Enterprise Manager query - 09-14-2005 , 08:02 PM



Thank you for your reply.

One related question.... Below I wrote that I get an error stating that
Parameters are not available, but it does work. It pops up a dialog, I type
in a parameter, and get what I am looking for. When constructing the view it
gives me the error, but it works later without error messages. Why?



"Sue Hoegemeier" wrote:

Quote:
SQL Server doesn't support parameterized views. That's
basically what the error is telling you. You can have
parameters for SQL statements (like the query), stored
procedures or you can use table valued parameterized user
defined functions.
But you can't use parameters in views.

-Sue

On Wed, 14 Sep 2005 09:00:14 -0700, kvr901
kvr901 (AT) discussions (DOT) microsoft.com> wrote:

Hello,

I am new to SQL Server 2000, and trying to learn it.

I have a small practice table with 5 records. One field is called
"fldcustomerID" in which the customer records are numbered 1,2,3,4,5.

OPEN TABLE
Using Enterprise Manager when I right click the TABLE to open the table as a
query (using the graphical query thing) and put a "?" in the criteria box of
"fldcustomerID" I get this:
SELECT *, fldCustomerID AS Expr1
FROM tblCustomer
WHERE (fldCustomerID = ?)
The above pops us a dialog into which I type the customer ID I want and it
works fine.


NEW VIEW
If I try the same thing by creating a VIEW when I type a "?" into the
criteria box of the query designer I am presented with a message:
"'Parameters' cannot be used in this query type." The SQL the designer
creates is:
SELECT dbo.tblCustomer.*, fldCustomerID AS Expr1
FROM dbo.tblCustomer
WHERE (fldCustomerID = ?)
When I run this it works just like the first query, and works fine.


Why do I get the error message?
Why does the query work?

Thank you.



Reply With Quote
  #4  
Old   
Sue Hoegemeier
 
Posts: n/a

Default Re: Help please: simple Enterprise Manager query - 09-18-2005 , 09:58 PM



It's probably just executing an parameterized query for you.

-Sue

On Wed, 14 Sep 2005 18:02:02 -0700, kvr901
<kvr901 (AT) discussions (DOT) microsoft.com> wrote:

Quote:
Thank you for your reply.

One related question.... Below I wrote that I get an error stating that
Parameters are not available, but it does work. It pops up a dialog, I type
in a parameter, and get what I am looking for. When constructing the view it
gives me the error, but it works later without error messages. Why?



"Sue Hoegemeier" wrote:

SQL Server doesn't support parameterized views. That's
basically what the error is telling you. You can have
parameters for SQL statements (like the query), stored
procedures or you can use table valued parameterized user
defined functions.
But you can't use parameters in views.

-Sue

On Wed, 14 Sep 2005 09:00:14 -0700, kvr901
kvr901 (AT) discussions (DOT) microsoft.com> wrote:

Hello,

I am new to SQL Server 2000, and trying to learn it.

I have a small practice table with 5 records. One field is called
"fldcustomerID" in which the customer records are numbered 1,2,3,4,5.

OPEN TABLE
Using Enterprise Manager when I right click the TABLE to open the table as a
query (using the graphical query thing) and put a "?" in the criteria box of
"fldcustomerID" I get this:
SELECT *, fldCustomerID AS Expr1
FROM tblCustomer
WHERE (fldCustomerID = ?)
The above pops us a dialog into which I type the customer ID I want and it
works fine.


NEW VIEW
If I try the same thing by creating a VIEW when I type a "?" into the
criteria box of the query designer I am presented with a message:
"'Parameters' cannot be used in this query type." The SQL the designer
creates is:
SELECT dbo.tblCustomer.*, fldCustomerID AS Expr1
FROM dbo.tblCustomer
WHERE (fldCustomerID = ?)
When I run this it works just like the first query, and works fine.


Why do I get the error message?
Why does the query work?

Thank you.




Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.