Forum Replies Created

Viewing 15 posts - 3,301 through 3,315 (of 3,543 total)

  • RE: date problem with SQL 2000

    Have you checked Regional Options on the server. I seem to remember having this problem before and always struggled with it. I have my servers set to British the date...

  • RE: Am I crazy?

    Quite right jpipes, I must learn to read the question properly before engaging brain

  • RE: Am I crazy?

    or

    select site_id,site_name,hardware_type,serial_number

    from hardware

    group by site_id,site_name,hardware_type,serial_number

    having count(*) > 1

  • RE: Linking Tables

    Try

    SELECT i.ItemName,c1.Name AS 'ManuName',c1.Name AS 'ServName'

    FROM INVENTORY i

    INNER JOIN COMPANIES c1 ON c1.ID = ManufacturerID

    INNER JOIN COMPANIES c2 ON c2.ID = ServicerID

  • RE: Distribuited query

    SQL must have permissions to the access db and be able to access it.

    Create a DSN (e.g. TEST) on the server to point to the access database.

    Use

    select * from OPENROWSET('MSDASQL','TEST';'admin';'','select...

  • RE: Complex view

    SELECT AttributeID,

    MAX(CASE WHEN ColumnID=1 THEN Data ELSE '' END) as '1Data',

    MAX(CASE WHEN ColumnID=2 THEN Data ELSE '' END) as '2Data',

    MAX(CASE WHEN ColumnID=3 THEN Data ELSE '' END) as '3Data',

    MAX(CASE WHEN...

  • RE: GROUP BY & SUM question

    Good one NPeeters, missed that one in my haste. I have had problems before with joins and duplicates/aggregation and thought this was similar. Thinking about it my solution would give...

  • RE: GROUP BY & SUM question

    Try this (quick solution untested)

    SELECT a.sales_year,

    sum(a.qty_ordered) as total_orders,

    sum(a.qty_shipped) as total_shipped,

    sum(a.price) as total_sales

    FROM (

    SELECT datepart(yy,sd.date_shipped) as sales_year,

    sd.qty_ordered,

    sd.qty_shipped,

    (p.price*sd.qty_ordered) as price

    FROM salesdetails sd INNER JOIN products p...

  • RE: Order by in Query problem

    Try creating dynamic sql and parse the briefcase and add case statements to the dynamic sql to do the order by.

    declare @briefcase varchar(100),@work varchar(100),@this varchar(10),@order varchar(1000),@ct int,@num int

    declare @sql nvarchar(4000)

    set...

  • RE: Mass Move - SQL 7 databases

    Not done this personally but several ways I would do it.

    Backup up all dbs on source and shutdown SQL on both source & dest. Copy all files db/master/msdb etc to...

  • RE: Use Results from a Cross Join for dynamic SQL

    Ok, had to use a cursor, try this.

    create table #tblResponses (Resp int, ProdName char(1), Value varchar(3))

    insert into #tblResponses values (1, 'A', 'Yes')

    insert into #tblResponses values (1, 'B', 'No')

    insert into #tblResponses...

  • RE: Use Results from a Cross Join for dynamic SQL

    Ah! Problem is me, me thinks. Sometimes it's difficult to explain what u have and what u want to someone else but I think we are getting there. I agree...

  • RE: Use Results from a Cross Join for dynamic SQL

    Have to look again tomorrow, but can u tell me what results you would expect from

    1 A Yes

    1 A Yes

    1 A Yes

    1 B Yes

    1 B Yes

    1 C Yes

    2 B Yes

    2...

  • RE: Use Results from a Cross Join for dynamic SQL

    Having trouble with the logic here.

    If respondent has A & B then you expect

    A 1

    If respondent has A & C then you expect

    A 1

    If respondent has B & C then...

  • RE: Use Results from a Cross Join for dynamic SQL

    Is this what u want

    create table #tblResponses (Resp int, ProdName char(1), Value varchar(3))

    insert into #tblResponses values (1, 'A', 'Yes')

    insert into #tblResponses values (1, 'B', 'No')

    insert into #tblResponses values (1, 'C',...

Viewing 15 posts - 3,301 through 3,315 (of 3,543 total)