Viewing 15 posts - 646 through 660 (of 1,217 total)
You say "I have two tables", but from the rest of the post it seems you have one table with two columns.. I will write the query for this situation,...
September 13, 2006 at 1:06 am
Hi Vandy,
this is a very frequent question on these forums. I'm sure you'll be able to find several topics about this problem, like for example http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=8&messageid=303442
However, the best recommendation...
August 25, 2006 at 7:21 am
The best way to treat errors is to not allow them at all (which is what Sergiy posted), and the best way to write cursors is to not write them...
August 24, 2006 at 1:07 am
Well, I suppose you understand how standard condition
WHERE my_column LIKE '%new%'
works. It returns all rows where the string in my_column contains "new". The query you are asking about does precisely...
August 24, 2006 at 12:44 am
I'm not sure why one would use precisely this form... IMHO it is more complicated than necessary, and the complication does not bring any advantages :
SELECT s.* FROM Students s...
August 23, 2006 at 5:14 am
You can't do that this way - a variable can not hold several comma-delimited values. There are two ways to solve such requirement - either use dynamic SQL (not really...
August 23, 2006 at 4:30 am
Using the query posted in the thread you are referring to, you can do this:
SELECT C.*, E_prim.contactName as [Primary], E_any.contactName as [Any],
COALESCE (E_prim.contactName,E_any.contactName) as [THE Contact]
FROM @tblCompanies C
LEFT JOIN...
August 23, 2006 at 3:31 am
Sergiy,
I think you overlooked this:
"I need to select the latest Visit (all columns) for each Patient listed in tblPatients. I want one record for each Patient."
That seems to be pretty...
August 23, 2006 at 2:21 am
Also see this post http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=8&messageid=302916 for a similar problem - even more complicated, because the requirement is not to number all rows from 1 to n, but to start numbering...
August 23, 2006 at 12:44 am
And one more way to do that - taking advantage of IDENTITY column (I'm using part of Ram's code, so that you can compare the differences):
/*prepare tables*/
DECLARE @tbl1 TABLE (ActualValue ...
August 22, 2006 at 4:10 am
By the way, I'm not sure I understand everything.. in the table IM_Grid, color is CHAR(9) and size is CHAR(5). In the first two tables, you have color_index and size_index,...
August 22, 2006 at 1:42 am
OK, after re-reading your post I decided to post this.. I'm not sure whether it helps, but let's hope so.
You didn't mention number of rows in table IM_Grid, but since...
August 22, 2006 at 1:27 am
Just a question, did you try to compare execution plans for different queries (hardcoded, join)? It is always good to start with that if you have problems with performance. Is...
August 22, 2006 at 1:04 am
Hello,
just to make clear what you need - post header says "Insert row count", but actually you seem to be asking for a way to SELECT (not insert) row number (not...
August 21, 2006 at 8:38 am
I would definitely use the JOIN solution... just check indexes on both tables and make sure execution plan is using them.
August 21, 2006 at 7:59 am
Viewing 15 posts - 646 through 660 (of 1,217 total)