Forum Replies Created

Viewing 15 posts - 3,451 through 3,465 (of 3,544 total)

  • RE: Query help...Reqd

    Will this do the trick

    select s.salesman,s.date,

    (case when (s.amount + isnull((select sum(amount) from Sales where salesman = s.salesman and date < s.date),0)) > l.Limits

    then (l.Limits - isnull((select sum(amount) from Sales...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Union 2 tables

    Sorry Jay, missed that one. The sql is good, so I think you are right about the data and espcially spaces, maybe try to remove them thus

    select x.Vessel,x.callid,sum(x.total_minutes) as total_minutes

    from...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Union 2 tables

    Try

    select x.Vessel,x.callid,sum(x.total_minutes) as total_minutes

    into tempweek

    from (select Siteid as Vessel,callid,sum(airtime) as total_minutes from oldbill02 with(index(siteid)) where callwhen >='12/31/2002' and substring(callnbr,5,3)<>'976' and siteid<>' ' group by siteid,callid

    UNION

    select Siteid as Vessel,callid,sum(airtime) as...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Putting dynamic SQL string together

    Try

    declare @sql varchar(1000)

    select @sql = 'insert DBTemp (TableName, trxYearMonthStart, nmbrtrx) '+

    'select '+@ProcessTable+','+

    'CONVERT(varchar(6), a.'+@SelectedColumn+', 112)+''01'','+

    'count(*) '+

    'from '+@ProcessTable+' a '+

    'left outer join history h on h.TableName = '''+@ProcessTable+''' '+

    'and CONVERT(varchar(6), h.'+@SelectedColumn+', 112)+''01''...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Help me.

    Try

    declare @EmpName varchar(50)

    declare @DBName varchar(50)

    declare @sql nvarchar(1000)

    set @DBName='EmpDB'

    set @sql = 'SELECT @EmpName=LName from '+@DBName

    exec sp_executesql @sql,N'@EmpName varchar(50) output',@EmpName output

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Linked Server Problem/Security?

    Don't know about 2k but with 7 I did the following for Access 2000 db.

    Created the linked server with the data source being the file name (e.g. c:\temp\db1.mdb) and set...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Linked Server Security

    Don't know about 2k but with 7 I did the following for Access 2000 db.

    Created the linked server with the data source being the file name (e.g. c:\temp\db1.mdb) and set...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Query help. Order in a set

    select count(*) as 'count',c.unit,c.[date]

    from (select distinct a.urn,a.[date],a.unit from #t a

    inner join (select urn,min([date]) as [date],min(unit) as 'unit' from #t group by urn) b

    on b.urn = a.urn and b.[date] = a.[date]...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: DTS Insert Data help!!!

    Try

    INSERT INTO table2(col1, col2, col3...col26)

    SELECT t.col1, t.col2, t.col3...t.col26

    FROM TempContactList t

    LEFT OUTER JOIN MasterContactList m

    ON m.col1 = t.col1 AND m.col2 = t.col2 AND m.col3 = t.col3...AND m.col26 = t.col26

    WHERE m.col1...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Copy_table_schema

    Forgot to mention I use SQL7 don't know if SQL2000 is the same or not!!!!

    In SQL7

    under 'Select Objects to transfer'

    uncheck 'Use default options'

    click on 'Options' button

    if you select 'Transfer SQL...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: ConnectionRead (recv()) error

    Had same situation and problem with SQL7 and vb apps. Have since put MDAC 2.7 on IIS (4.0) server and SP4 (SQL7 SP4 has reference to fix conn problems) and...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Copy_table_schema

    I create script files for all my objects and therefore can create the database anywhere with any name.

    If I want to transfer like you do then I do the following

    Create...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: data pump only sends 255 characters to text file

    I think it must a retriction with the text driver with delimited files. If you change to fixed field you should get all your data. Probably not much use if...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Dynamic SQL in cursor

    Antares686 is right, you have to use

    set @sql = 'DECLARE curs CURSOR FOR select col1,col2 from ' + @table

    exec sp_executesql @sql

    OPEN curs

    FETCH ....

    CLOSE curs

    DEALLOCATE curs

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Using Dynamic SQL in a Cursor

    Try

    set @sql = 'DECLARE z_cursor CURSOR FOR select storeid from ' + @table

    exec sp_executesql @sql

    OPEN z_cursor

    FETCH ....

    CLOSE curs

    DEALLOCATE curs

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 15 posts - 3,451 through 3,465 (of 3,544 total)