Forum Replies Created

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

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

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

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

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

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

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

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

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

  • 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...
  • RE: Counting "incomplete" fields in tables

    If the number of columns and column names is not too large then you could try this

    declare @tablename varchar(50)
    
    set @tablename = 'tablename'
    declare @sql nvarchar(4000)
    declare @colct...

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