Viewing 15 posts - 241 through 255 (of 683 total)
How's this?
--Preparation
declare @t1 table (start_date_time datetime, ani varchar(20), dialed_digits varchar(20), actual_dur int, rounded_dur int, cost money)
insert @t1
select '03/01/2008 00:05:57', '629172162448',...
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
April 14, 2008 at 6:04 am
Any of these will do the sorting...
SELECT PERSON, SUM(T_VOTES) AS TOTAL
FROM VOTING
GROUP BY PERSON
ORDER BY SUM(T_VOTES)
SELECT PERSON, SUM(T_VOTES) AS TOTAL
FROM VOTING
GROUP BY PERSON
ORDER BY 2
SELECT PERSON, SUM(T_VOTES) AS TOTAL
FROM VOTING
GROUP...
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
April 11, 2008 at 2:48 am
Andras Belokosztolszki (4/10/2008)
That's useful - thanks Andras.
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
April 10, 2008 at 3:29 am
I don't know exactly, but you can probably do something along the lines of...
select * from information_schema.tables
where table_type = 'base table' and table_name in (
select distinct...
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
April 10, 2008 at 3:13 am
you cannot EXEC a function
That's not strictly true. This works...
DECLARE @lcPostArea VARCHAR(4)
EXEC @lcPostArea = dbo.PostArea @lcPostcode = 'HX1'
SELECT @lcPostArea
Although the "SELECT dbo.PostArea('HX1')" is of course shorter.
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
April 10, 2008 at 3:05 am
Your while loop needs a begin..end around the set statements...
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
April 10, 2008 at 2:59 am
Hi all,
I've just caught up with the thread.
This would be my latest try based on the discussions...
; with x as (select ChildNo, ChildRev from #Children where ParentNo = @ParentNo and...
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
April 9, 2008 at 9:17 am
Like this?
--Create temporary table that holds Parent and Children records.
IF OBJECT_ID (N'tempdb..#Children', N'U') IS NOT NULL
DROP TABLE #Children;
CREATE TABLE #Children (ParentNo VarChar(50), ParentRev Int, ChildNo VarChar(50), ChildRev Int)
--Insert test data...
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
April 9, 2008 at 6:56 am
I think my timing may be a little off, but anyway...
declare @t table (x xml)
insert @t
select '<a link="x" />'
union all...
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
April 9, 2008 at 5:48 am
I think my timing may be a little off here, but anyway.
This is pretty inelegant, but it is one way...
create table Table1 (ID int)
insert Table1
...
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
April 9, 2008 at 5:37 am
Or this?
IF EXISTS (SELECT * FROM dbo.table1 WHERE school = 'xxxxxxxxxxxxx')
SELECT COUNT(*) AS thecount
FROM ...
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
April 9, 2008 at 4:57 am
A CASE statement will allow you to do more complicated stuff. Your exact request can be done without...
update Employees set FullName = FirstName + ' ' + LastName
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
April 8, 2008 at 9:04 am
Easy...
SET @x.modify('delete //xdata/project/store_number/@xsi:nil')
This is XML DML, and you can read about it in BOL or online...
http://msdn2.microsoft.com/en-us/library/ms177454.aspx
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
April 8, 2008 at 8:58 am
Like this?
declare @x xml
set @x = '<xdata>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<name>bob</name>
<store_number xsi:nil="true" />
</project>
</xdata>'
SET @x.modify('insert text{"1"} as first into (//xdata/project/store_number)[1]')
select @x
--result
/*
<xdata>
...
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
April 8, 2008 at 5:17 am
jomobono (11/21/2007)
Maybe you could write a book on it jomobono 😀
The kitchen analogy is a good one to illustrate another point. Often what the customers wants will be established (using...
Ryan Randall
Solutions are easy. Understanding the problem, now, that's the hard part.
November 21, 2007 at 7:36 pm
Viewing 15 posts - 241 through 255 (of 683 total)