Forum Replies Created

Viewing 15 posts - 766 through 780 (of 921 total)

  • RE: day wise report

    
    
    SELECT DATEPART(dw,DateCol), SUM(AmtCol)
    FROM TheTable
    GROUP BY DATEPART(dw,DateCol)

    You can use CASE() with DATEPART() in the select clause to show the day of week as its name.

    --Jonathan

  • RE: REPLACE on text column

    quote:


    Thanks for the answers so far.

    vbCrLf is the VB constant for carriage return plus a line feed, so I guess I have...

  • RE: REPLACE on text column

    WHILE @@ROWCOUNT > 0

    BEGIN

    UPDATE TheTable SET TextCol =

    SUBSTRING(TextCol,1,PATINDEX('%<BR>%',TextCol) - 1) +'vbCrLf' +

    SUBSTRING(TextCol,PATINDEX('%<BR>%',TextCol)+4, DATALENGTH(TextCol) - PATINDEX('%<BR>%',TextCol))

    WHERE TextCol LIKE '%<BR>%'

    END

    --Jonathan

  • RE: SQL server table logging

    quote:


    When you do transaction log backul on db with Bulk-Logged recovery model, the backup contanins:

    1) Content of the transaction log which covers...

  • RE: Select "first" line from each group

    quote:


    Jonathan's solution won't work if the minimum values of both columns are not in the same row. It will return unrelated data.

    A...

  • RE: How to split records into a temp table?

    quote:


    Hello Jonathan,

    This is indeed a smart solution that u have provided. Just a query...how good a practice, is it to refer to...

  • RE: Help with Between Statement

    If there will ever be an index on your date column, you're better off not using BETWEEN. As you've got the surrounding dates as just dates with no times,...

  • RE: Select "first" line from each group

    Use the results as a derived table and then just GROUP BY again.

    SELECT Col1, MIN(Col2), MIN(Col3)

    FROM Results

    GROUP By Col1

    --Jonathan

  • RE: How to split records into a temp table?

    As long as none of the courses will ever extend more than 255 days, you could use SQL Server's built-in Numbers table:

    SELECT c.vcCourseTitle, c.dtTripStart + v.Number DayOffered

    FROM Courses c JOIN...

  • RE: exec sproc from another sproc

    Here's how to use output parameters:

    
    
    CREATE PROCEDURE dbo.getModuleTitle
    @ModuleID int,
    @ModuleTitle nvarchar(50) OUTPUT
    AS
    SET NOCOUNT ON
    SELECT @ModuleTitle = ModuleTitle
    FROM dbo.Modules
    WHERE ModuleID = @ModuleID
    go
    CREATE PROC myUpdate
    @ModuleID int
    AS
    SET...
  • RE: Upper case string to Title case conversion

    If all values do not require converting, I suggest you use the UDF with a WHERE clause like this:

    
    
    UPDATE MyTable
    SET MyCharCol = dbo.udf_Proper(MyCharCol)
    WHERE CAST(MyCharCol AS varbinary(8000))...
  • RE: Trigger Results

    quote:


    The @@ROWCOUNT suggestion did the trick!

    The NEW statement is:

    DECLARE @SEQ int

    IF @@ROWCOUNT <> 0

    BEGIN

    SELECT @SEQ = (SELECT SeqNbr FROM DELETED)

    INSERT INTO tblActions(action_type,...

  • RE: SQL server table logging

    quote:


    I just think the logs aren't useless because when you do transaction log backup on db with Bulk-Logged recovery model, sql server...

  • RE: Attaching Databases

    quote:


    You are right. I should say script all objects from your original database and create them in SQL Server 7.0 database, BCP...

  • RE: Attaching Databases

    quote:


    Or the traditional way, BCP.


    bcp is for copying data, it will...

Viewing 15 posts - 766 through 780 (of 921 total)