Forum Replies Created

Viewing 15 posts - 376 through 390 (of 1,347 total)

  • RE: connect to database using SQL Query Analyzer

    >>Do I have to type in a database name as well? inorder to connect to a specific database.

    When you connect, you are automatically in the default database associated with your login on...

  • RE: Retrieving the current date

    Select getdate() As DateWithTime,

       dateadd(d, 0, datediff(d, 0, getdate())) As DateOnly

    Result:

    DateWithTime            DateOnly

    2006-07-11 07:51:52.353 2006-07-11 00:00:00.000

  • RE: Retrieving the current date

    Don't force the server to perform type conversion from date to string & back again. Use this as teh default:

    dateadd(d, 0, datediff(d, 0, getdate()))

     

  • RE: DTS in Stored Procedures

    >>while running the Stored procedure

    How are you "running" the stored procedure ? Via query analyser ? Via a scheduled agent job ?

    How is the stored procedure calling the DTS packages...

  • RE: update matching columns of another table

    Update t2

    Set LetterColumn = t1.LetterColumn

    From Table2 As t2

    Inner Join Table1 As t1

      On (t1.NumberColumn = t2.NumberCOlumn)

     

  • RE: Error Message

    Columns of datatype timestamp are maintained by the system and shouldn't be in your INSERT column list. The error is telling you that you're trying to insert an explicit value...

  • RE: Rewriting an update statement without using a cursor

    UPDATE D

    SET LicenseStateDifferent = 

        CASE WHEN P.State IS NULL THEN 'Y' ELSE 'N' END 

    FROM Drivers As D

    LEFT JOIN Policy As P

      ON ( D.Id = P.Id AND

             (D.State = P.State...

  • RE: passing value question

    declare @sRecipients varchar (255), @sSubject varchar (1024)

    Declare @CountResult As int

    Declare @EmailBody As varchar(500)

    SET @sRecipients = 'sqlserver@domain.com';

    SET @sSubject = 'TestCount';

    SELECT @CountResult = count(TypeCd)

    from table1...

  • RE: Using GROUP BY in a SELECT statement with Multi-CASE

    If you have an expression generating a column in the resultset, and you need to GROUP BY the expression, you need to replicate all the code for the expression.

    An alternative...

  • RE: Query Optimizer question

    >>When I said "remove the join" I actually meant to replace it with an extra search argument

    By doing that, you are creating an entirely different scenario for the optimizer and...

  • RE: Interview question

    From Books Online:

    UNION

    Specifies that multiple result sets are to be combined and returned as a single result set.

    ALL

    Incorporates all rows into the results, including duplicates. If not specified,...

  • RE: Variable versus explicit value

    >>and @CampaignID is retreived within the SP based on @UploadControlID, so yes it's local.

    Why not take whatever query generates @CampaignID and make it a derived table that is joined to...

  • RE: Missing data in linking table

    SELECT t1.OrgID

    FROM YourTable As t1

    WHERE NOT EXISTS (

      SELECT *

      FROM YourTable As t2

      WHERE t1.OrgID = t2.OrgID

      AND     t2.RoleID = 2

    )

  • RE: query: reference query columns from within query

    Select out of a derived table:

    Select first, second, first + second

    From

    -- Create derived table within parentheses

    (

      Select 1 As first, 2 As second

      From Yourtable

    ) dt

  • RE: Sloooooow stored procedure

    Not enough info.

    What is the source of the inserted rows ? A join of 2 or more tables ? Are there input parameters to the stored prcoedure that are used...

Viewing 15 posts - 376 through 390 (of 1,347 total)