Viewing 15 posts - 3,331 through 3,345 (of 3,543 total)
Have you tried putting the query in a variable and using sp_executesql or will this not work in the way you want to use it?
April 29, 2003 at 10:29 am
if you want the resulting column to be datetime then you could use Antares solution as well, eg
select DATEADD(d,DATEDIFF(d,0,chargedate),0), sum(chargeAmount)
from charges
group by DATEADD(d,DATEDIFF(d,0,chargedate),0)
order by DATEADD(d,DATEDIFF(d,0,chargedate),0)
April 29, 2003 at 2:50 am
Jeremy,
The only problem with your solution is if the dates span more than one year and the results are required in date order, your query would group by month first.
...
April 29, 2003 at 2:31 am
select CONVERT(varchar(10),chargedate,110), sum(chargeAmount)
from charges
group by CONVERT(varchar(10),chargedate,120)order by CONVERT(varchar(10),chargedate,120)
April 29, 2003 at 2:24 am
Suggest you make this a permanent table (temp for testing)
create table #equivalent (digit char(1),digitdec int,equiv int,equivdbl int)
insert into #equivalent values ('0',0,0,0)
insert into #equivalent values ('1',1,1,2)
insert into #equivalent values ('2',2,2,4)
insert into...
April 28, 2003 at 4:05 am
If you want the current date inserted in a table, I use
CONVERT(varchar(10),GETDATE(),120)
April 25, 2003 at 2:05 am
Or you could put the results of the proc in a temp table and process from there, eg
create table #t (TABLE_QUALIFIER varchar(255),TABLE_OWNER varchar(255),TABLE_NAME varchar(255),COLUMN_NAME varchar(255),KEY_SEQ int,PK_NAME varchar(255))
INSERT INTO #t
EXEC sp_pkeys...
April 25, 2003 at 1:59 am
Create empty tables in dest db (either script or use copy without data) then use dts to transfer the data with a where clause.
Edited by - davidburrows on 04/24/2003 ...
April 24, 2003 at 3:14 am
I'm on SQL7 SP4 and can delete using current of cursor, e.g.
create table #t (a varchar(10))
insert into #t values ('A')
insert into #t values ('AA')
insert into #t values ('AA')
insert into #t...
April 24, 2003 at 3:09 am
I agree with Jeremy, there is no right or wrong with this type of question. I use whatever gets the job done with a reasonable balance between easy code and...
April 24, 2003 at 2:03 am
Depends on how static the data is and whether you create the recordset on each pass or not.
If you are using ADO you can use PageSize, PageCount and AbsolutePage to...
April 23, 2003 at 2:17 am
If you are using VB to read/write and cleanse the file then open the file in binary mode and use the get command. This will retrieve all the characters in...
April 23, 2003 at 2:04 am
Only had time for a quick peek. I would name each control in the WITNESSES / PASSENGERS block the same (eg WitnessOrPassengerName,Witness,Passenger etc)
IE will make them an array. When you...
April 22, 2003 at 10:48 am
Sorry missed that one. It's the way subqueries work. If you include a subquery as part of the select then the subquery must only return one value (thats why I...
April 22, 2003 at 10:02 am
Try this
SELECT a.SiteID,
a.[DateTime],
b.Cash AS '4aTotalCash',
--Start Subquery
(SELECT SUM(b2.Cash) AS '4TotalCash'
FROM TableA a2 LEFT OUTER JOIN
TableB b2 ON a2.SiteID = b2.SiteID AND a2.[DateTime] = b2.[Date]
WHERE a2.SiteID = a.SiteID AND a2.[DateTime] =...
April 22, 2003 at 2:40 am
Viewing 15 posts - 3,331 through 3,345 (of 3,543 total)