Forum Replies Created

Viewing 15 posts - 3,166 through 3,180 (of 3,544 total)

  • RE: Complex Query -- Help needed

    The problem is in the last case (could not test this). It needs an extra bracket

    SUM(CASE WHEN (oh.quote_minutes >= 90 AND ISNULL(oh.timedorder,0))
    
    THEN 1 ELSE 0...

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

  • RE: Complex Query -- Help needed

    Why not simply the query, like so

    SELECTRegions.Description, 
    
    COUNT(oh.id) AS TotalOrders,
    SUM(CASE WHEN (ISNULL(oh.timedorder,0) = 0)
    THEN 1 ELSE 0 END) AS TotalASAP,
    SUM(CASE WHEN (oh.timedorder...

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

  • RE: BCP error

    Are you running BCP or 'BULK INSERT'? Are you using a format file?

    I seem to remember a while ago some MS articles referring to the version of format files being...

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

  • RE: copy ima field from one record to another record

    DECLARE @ptr_from varbinary(16)
    
    DECLARE @ptr_to varbinary(16)
    SELECT @ptr_from = TEXTPTR(columna) FROM tablea WHERE rowid = {fromid}
    SELECT @ptr_to = TEXTPTR(columna) FROM tablea WHERE rowid = {toid}
    UPDATETEXT tablea.columna @ptr_to 0...

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

  • RE: query

    Try this (untested)

    SELECT DISTINCT 
    
    a.JobId,
    a.fromstoreId,
    b.storeName,
    a.toStoreId,
    c.storeName
    FROM tblJob a
    INNER JOIN tblClient cl ON cl.clientId = b.clientId
    INNER JOIN tblStore b ON b.storeId = a.fromstoreId
    LEFT OUTER JOIN tblstore...

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

  • RE: Restore DB From VB.Net

    You cannot restore a database whilst you are connected to it. Make sure your connection connects to another database (eg master) with a user that has enough privilege to restore...

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

  • RE: Population of table

    Is this waht you are looking for

    SELECTRefID, 
    
    SUM(CASE WHEN [Day] = 1 THEN CAST(SUBSTRING([Hour],1,2) AS int) ELSE 0 END) AS 'day1',
    SUM(CASE WHEN [Day] =...

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

  • RE: Date in varchar, Need conversion

    I am still confused, the queries you posted already have a where clause. Are adding to the where clause, eg

    AND LIBPER .....

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

  • RE: Using Dynamic T-SQL execution

    Try this

     declare @sql nvarchar(4000)
    
    set @sql = ''
    select @sql = @sql + 'use '+name+' select * from sysfiles ' from sysdatabases
    exec sp_executesql @sql

    Or this

    sp_MSforeachdb @command1...

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

  • RE: Date in varchar, Need conversion

    I have tried both the queries as written and do not get any errors. I do not see how the where clause (present or not) would cause a date issue!!!...

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

  • RE: Sorting

    If sorting on name for instance, I do the following

    SELECT ID, Name 
    
    FROM NameType
    ORDER BY (CASE WHEN Name IS NULL THEN 1 ELSE 0...

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

  • RE: DTS Import Fixed-Length ASCII File - NULL and TRIM

    Hi Terry,

    If you delete all the transformations, select all the columns (source & dest), select ActiveX and new, then you should get a single script with one line per column...

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

  • RE: DTS Import Fixed-Length ASCII File - NULL and TRIM

    In DTS each column transformation can be either copy column or ActiveX script. If you change each column transformation to ActiveX you can then test the source and set the...

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

  • RE: DTS Import/Export error reading CSV

    The DTS wizard needs data in the file to analyze it to attempt to find column(s). Edit the file to put at least one line with data matching the columns...

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

  • RE: Creating a count field in DTS/T-SQL.

    Do you like this

    create table #pc (idno int,p varchar(8))
    
    insert into #pc values (0,'AA1 BB1')
    insert into #pc values (0,'AA1 BB1')
    insert into #pc values (0,'AA1 BB1')
    insert into...

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

Viewing 15 posts - 3,166 through 3,180 (of 3,544 total)