Forum Replies Created

Viewing 15 posts - 316 through 330 (of 426 total)

  • RE: Replacing cursor issue

    If all you need is to parse the strange date format, then Try:

    DECLARE @DateStr varchar(50)

    SET @DateStr = '03/Jun/2005:11:16:40'

    SELECT CONVERT(varchar,REPLACE(LEFT(@DateStr,11),'/',' ')+' '+ RIGHT(@DateStr,8),113) AS Europe_default

    Andy

  • RE: Is it possible to do the conditional count?

    You can take advantage of COUNT ignoring NULL like this:

    SELECT SourceFile,

           COUNT(ID) AS Records,

           COUNT(NULLIF(Processed,'some value to exclude')) AS RecordsProcessed

    FROM dbo.tbl_1

    GROUP BY SourceFile

    Andy

  • RE: Sending reports with CDONTS.NewMail

    I would suggest changing your code structure like this:

    DECLARE @object int

    -- the rest of your variables

     , @hr int

     , @src varchar(255)

     , @desc varchar(255)

    ...

    --##Create Message object

    EXEC @hr = sp_OACreate 'CDO.Message', @object OUT

    IF...

  • RE: Indexes - Rebuild or Recreate?

    Depending on the data load and the indexed values, sometimes you are better off dropping the index, loading the data, then creating the index. The only way to know is...

  • RE: TB Database on SQL Server

    I agree with Ford that the best would be 3, script the existing server, and transfer to the New server after tweaking the scripts for the desired re-organization.

    I would...

  • RE: Connection Error

    Make sure that the Connection string does not have a Mode= setting that may be causing multi-user issues.

    If you are using IIS, on the Web server: Add the IUSR_<machinename> and...

  • RE: cumulative running total in a query?

    Try this:

    if exists (select * from dbo.sysobjects

     where id = object_id(N'Test')

     and OBJECTPROPERTY(id, N'IsUserTable') = 1)

     drop table Test

    GO

    CREATE TABLE Test (MemberNo varchar(6)

     , ClaimCount int

     , RunningTot int)

    GO

    INSERT INTO Test (MemberNo,ClaimCount)

    VALUES...

  • RE: help with a query, perhaps i''''m just blind

    Try:

    SELECT resid.[name] as typename,

     COUNT(re.renderedemailstatusid) AS numEmails

    FROM renderedemailstatustypes as resid

      LEFT JOIN renderedemails AS re

        ON resid.renderedemailstatusid = re.renderedemailstatusid

          AND re.emailsessionid = 313

    GROUP BY resid.[name]

    Andy

  • RE: date time query

    Use the ISO date format and it will not matter what DATEFORMAT your server or client uses:

    declare @x varchar(8)

    SET @x ='20030311'

    select * from task where convert(varchar(8),task.entrydt,112) >= @x

    select * from...

  • RE: Help with String manipulation

    Try this one:

    DECLARE @Name varchar(80)

    SET @Name = 'Sara Jane Smith-Jones'

    SELECT

      RTRIM(LEFT(@Name,LEN(@Name)-CHARINDEX(' ',REVERSE(@Name)))) AS FirstName

      , LTRIM(RIGHT(@Name,CHARINDEX(' ',REVERSE(@Name)))) AS LastName

    Andy

  • RE: How do i get the host name?

    If SQL Server is installed as the default instance, then SELECT @@SERVERNAME will return the netbios server name.

    Andy

  • RE: Porting entire Oracle9i schemas to SqlServer 2000 or 2005

    I have used Visio 2003 for Enterprise Architects, be aware that even with 2003 in the name, it is actually Visio 2002. This is part of the Visual Studio .NET...

  • RE: Converting data Types with Active X transformation

    CInt converts to a smallint, could that be the problem, if your SessionID is an int then use CLng instead of CInt.

    Andy

  • RE: Replacing a Cursor

    DECLARE @MerchID varchar(16)

      , @LastMerchID varchar(16)

    SELECT TOP 1 @MerchID = MerchID

    FROM DailyData

    WHERE  MerchID > @LastMerchID

    ORDER BY MerchID

    WHILE LEN(@MerchID) > 0

    BEGIN

      ...

      -- Loop

      SET @LastMerchID = @MerchID

      SELECT...

Viewing 15 posts - 316 through 330 (of 426 total)