Forum Replies Created

Viewing 15 posts - 3,331 through 3,345 (of 3,543 total)

  • RE: Another one - dynamic sorting w/ Unions

    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?

  • RE: datetime function

    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)

  • RE: datetime function

    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.

    ...

  • RE: datetime function

    select CONVERT(varchar(10),chargedate,110), sum(chargeAmount)

    from charges

    group by CONVERT(varchar(10),chargedate,120)order by CONVERT(varchar(10),chargedate,120)

  • RE: vb function to sql svr

    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...

  • RE: datetime function

    If you want the current date inserted in a table, I use

    CONVERT(varchar(10),GETDATE(),120)

  • RE: how would You determine the fields in a PK?

    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...

  • RE: How to use Copy SQL Server Objects Task?

    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 ...

  • RE: Whats the Replacement??

    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...

  • RE: Cursors - Are they always the wrong way

    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...

  • RE: displaying data by pages

    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...

  • RE: Importing Text Files with abnormal characters

    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...

  • RE: Inserting more than one value for same field

    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...

  • RE: Having trouble with a subquery...

    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...

  • RE: Having trouble with a subquery...

    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] =...

Viewing 15 posts - 3,331 through 3,345 (of 3,543 total)