Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 Select where this and where that

Author  Topic 

mortoleeuk
Starting Member

5 Posts

Posted - 2005-09-08 : 11:34:39
[code]SELECT * FROM tbl_customers WHERE customer_fname = 'Lee' && customer_lname = 'Morton'[/code]

I think you can probably tell what I want from that, but how do I do it? that && doesnt work, tried "AND" and "&" also.

X002548
Not Just a Number

15586 Posts

Posted - 2005-09-08 : 11:38:13
It's AND

But where are you doing this? Are you using Query Analyzer?

Are we talking about SQL Server?



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

mortoleeuk
Starting Member

5 Posts

Posted - 2005-09-08 : 11:42:52
Yeah i just want it to work in query anal at the moment

i get this error for
SELECT * FROM tbl_customers WHERE customer_fname = 'Lee' AND customer_lname = 'Morton'


Server: Msg 208, Level 16, State 1, Line 1
Invalid object name 'tbl_customers'.

But, if I run my insert code it for the table it works

Go to Top of Page

mortoleeuk
Starting Member

5 Posts

Posted - 2005-09-08 : 11:57:03
actually its doing it on the insert code... why does one problem just lead to another, check out the jpg

Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-09-08 : 11:59:30
Case sensitive database?

if not try this to see if the table has a different owner

SELECT TABLE_SCHEMA + '.' + TABLE_NAME
FROM INFORMATION_SCHEMA.TABLES
ORDER BY TABLE_NAME, TABLE_SCHEMA

Kristen
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-09-08 : 12:00:30
Scratch that, your screen shot shows that you are in the "master" database,

type
USE [ComputerMOTdb]

(is there a space in there? I can't see it clearly)

Kristen
Go to Top of Page

homebrew
Posting Yak Master

114 Posts

Posted - 2005-09-08 : 12:14:57
Sounds like a D'OH is in order !! :-)
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-09-08 : 12:20:08
"Sounds like a D'OH is in order"

mortoleeuk's first post. For all I know s/he only started using SQL today!

Kristen
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2005-09-08 : 12:23:16
Reminds me of a time I sent a t-sql script to modify a production database.

Prod DBA: " Your script failed"
Me: " Are you sure, I tested in several environments before I sent to you"
Prod DBA: "Nope it failed, it say invalid object"
Me: " Are you running in the the Tax Database?
Silence

I use "USE" All the time now at the beginning of every release script.





Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-09-08 : 12:32:28
"Silence"

That's the sound of a DBA trying to work out how to reverse a script

I expect the thinking goes like this:

Did I back up the TAX database before I started? Yup

So what *$%(*!& database am I in?

And possibly: "And what did the script manage to change?"

Kristen

Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2005-09-08 : 12:34:41
in master no less....

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-09-08 : 12:35:46
... now full of SProcs doing nothing useful, and having an Eppy with sysdepends ...

Kristen
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2005-09-08 : 12:38:22
That was quite awhile ago now.

He's no longer with us.



Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2005-09-08 : 13:44:04
"He's no longer with us"

Nor your Sprocs in master, I dare say

I've just found a dead wasp in my glass of wine - Yuck!

a) Clearly the bottle was open too long and b) my answers may deteriorate for the rest of the evening until Margareta-ville overtakes me!

Kristen
Go to Top of Page
   

- Advertisement -