Forum Replies Created

Viewing 15 posts - 166 through 180 (of 1,347 total)

  • RE: Insert into existing table from Query

    If the table is already created, the syntax is:

    INSERT INTO t_Table2

    SELECT col1,col2,col3

    FROM   t_Table1

    WHERE id > 23 and active = 1

  • RE: INSERT_UPDATE Stored Proc

    You will save yourself a career-full of problems if you indent your code:

    IF @header_id = -1

    BEGIN

      -- Insert the into headers --

      INSERT INTO [headers]

      (

      [header_file]

      ,[fk_admin_menu_id]

      ,[fk_admin_submenu_id]

      )

     ...

  • RE: Select top groups

    Because of the issues with ties, I resorted to solving this with a temp table and an absolute ranking for each record. The absolute ranking allows easy retrieval of the...

  • RE: Query Help (SubQuery?)

    >>No column was specified for column 1 of 't1'.

    t1 is a derived table. All columns in a derived table must be explicitly named. The expression max(date_start) has not been assigned...

  • RE: Select top groups

    This is on SQL2K, right, and not SQL 2005 ? (Asking because there is a simpler solution in 2005 using the new ranking functionality in T-SQL).

     

  • RE: joining to a table twice for getting two different counts

    If the join is essentially the same in both cases, but with more constraints on the count, you can solve it with just one join, by moving the expression into...

  • RE: Trigger & Stored Procedure Question

    Don't forget, inserted & deleted tables are not available inside the stored proc.

    If the @parameters you're passing into the stored proc are somehow derived from a query on the inserted/deleted...

  • RE: Trigger Question

    You're trigger is written to only support 1 record at a time inserts to the table. Can you ever have scenarios where the number of records inserted in a batch...

  • RE: query help

    Best, you've been working on these GE Policy tables for over 6 weeks. All your 90+ postings to date are about these same tables & queries.

    http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=8&messageid=328266

    You've had 'invalid column...

  • RE: two joins to same view is causing my count to be squared

    Does thsi:

    JOIN vwEventHistoryWithInterpolatedAndOutlierAdjusted eh ON eh.[year] = nh.[year]

    AND eh.netSquareFeet > n.nsfCategoryMin

    AND eh.netSquareFeet <= n.nsfCategoryMax

    AND eh.HasTwoYearsContinuousData = 1

    AND eh.HasEnoughDataPoints = 1

    AND eh.isConsumerEvent = 0

    AND eh.netSquareFeet IS NOT NULL

    .....

  • RE: date expression

    What are the datatypes of the 2 columns ?

    Are they true date/time types (datetime or smalldatetime) or are the char/varchars containing date & time formatted into a string ?

  • RE: Defining transformations programmatically?

    ROWTERMINATOR = '\r'   - carriage return only

    ROWTERMINATOR = '\n'   - CR/LF pair

     

  • RE: Defining transformations programmatically?

    Typically I don't use a data pump unless I absolutely have to. It's good for some types of data movement, but if it's just a simple field-to-field import with no...

  • RE: Doing multiple inserts with a subquery?

    Work through it in steps.

    How do you find the other employees of the same company ? Need to join tblEmployee to itself:

    Select e1.EmpID, e2.EmpID As OtherEmployeeID

    From tblEmployee As e1

    Inner...

  • RE: Defining transformations programmatically?

    If it's just simple text file import, do you even need DTS ?

    Have you tried T-SQL BULK INSERT ? Or BCP from the command line ?

Viewing 15 posts - 166 through 180 (of 1,347 total)