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 Query

Author  Topic 

supersql
Yak Posting Veteran

99 Posts

Posted - 2005-09-22 : 11:29:35
HI, Here is my query..
select *from fileh fh
inner join documenth dh on fh.filehid=dh.filehid
inner join documentt dt on fh.filehid=dt.filehid
inner join documentv dv on fh.filehid=dv.filehid

This join has total of 40 columns from all the 4 tables. How can I use this query to select only 4 columns, 1 from each table.Do I need to assign this query to a variable and select only 4 columns from tht variable.

SamC
White Water Yakist

3467 Posts

Posted - 2005-09-22 : 11:49:25
Select fh.ColumnX, dh.ColumnY, dt.ColumnZ, dv.ColumnZZTop
FROM fileheaders fh ...
Go to Top of Page

supersql
Yak Posting Veteran

99 Posts

Posted - 2005-09-22 : 14:34:14
Hi
For the same query when I have a where clause like
"where amount='4184.0600'"
I am getting the follwing error.

Server: Msg 260, Level 16, State 1, Line 1
Disallowed implicit conversion from data type varchar to data type money, table 'test.dbo.DocumentT', column 'Amount'. Use the CONVERT function to run this query.
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2005-09-22 : 14:38:59
what is your question? The error statement told you how to fix the error?

Help us help YOU!
Read this blog entry for more details: http://weblogs.sqlteam.com/brettk/archive/2005/05/25.aspx

*need more coffee*
SELECT * FROM Users WHERE CLUE > 0
(0 row(s) affected)
Go to Top of Page

SamC
White Water Yakist

3467 Posts

Posted - 2005-09-22 : 15:06:19
Try omitting the single quotes. It makes a VARCHAR datatype.

"where amount=4184.0600"
Go to Top of Page

supersql
Yak Posting Veteran

99 Posts

Posted - 2005-09-22 : 15:22:20
thanks Sam, its working fine.
Go to Top of Page
   

- Advertisement -