Forum Replies Created

Viewing 15 posts - 13,351 through 13,365 (of 13,849 total)

  • RE: Join tables and INSERT

    So does

    select o.OfficeID, d.DeptID, s.SectionID

    from offices o join depts d on o.OfficeID = d.OfficeID join Sections s on d.DeptID = s.DeptID

    Give you the results you want to insert to table4?

  • RE: Null value is eliminated by an aggregate or other SET operation

    Assuming that you want any NULLs to be summed as zeroes, use the isnull() function to get rid of the worrying error:

    select client,productcode,modifiedlot,location,sku,count(*) ct,cast(sum(isnull(grosswgt,0)) as decimal(18,4)) grosswgt,

      cast(sum(isnull(netwgt,0)) as decimal(18,4))...

  • RE: Join tables and INSERT

    What is the relationship between the first three tables?  Insertion is performed through use of the INSERT statement, believe it or not

    Here's an example:

    INSERT...

  • RE: Probably a very simple question.

    Hey, it's not as easy as you might think.  Try this (untested):

    update m1

    set SettingValue = 'True'

    from ModuleSettings m1

    where exists (select m2.ModuleID from ModuleSettings m2 where m2.SettingName = 'GroupType' and m2.SettingValue...

  • RE: Trigger not firing

    Good tip

  • RE: Problems with Alter Table and Update in DTS

    The top three lines appear to be duplicated for some reason - not that it matters.

    To make this more manageable, I suggest that you implement this as a stored procedure...

  • RE: auto incremental field

    Remember that such a trigger probably needs to deal with the insertion of multiple rows - a tasty bit of coding that might require a cursor.  Recommend that you stay...

  • RE: How to read from a table that is ''''passed in'''' as a parameter

    How about putting the whole statement in one string and then executing that?  Something like this:

    create procedure TestInputTable (@InputTable varchar(100))

    as begin

     declare @strSQL varchar(8000)

     set @strSQL= 'select * into #TempTable from '...

  • RE: Scripting out all database table index

    Yeah, that works, good thinking.  Obviously if an index definition has changed, the 'check for existing' is necessary as you'd want to replace the one that's there currently.

  • RE: Trigger not firing

    When you debug a stored proc which contains statements that fire a trigger, you do not get to debug the statements in the trigger - even if they are executing...

  • RE: Scripting out all database table index

    You can script the indexes one at a time (yawn) in Query Analyser, without getting the tables scripted.  I can't see how you can do this in one step for...

  • RE: Trigger not firing

    This is probably just my preference, but I think I would combine these two INSERTs into a single trigger.

    Are you receiving any error messages?  Try performing a simple INSERT through QA...

  • RE: Finding duplcate data in one table column

    select stud_id, count(stud_id)

    from table

    group by stud_id

    having count(stud_id) > 1

    will give you a list of stud_ids with more than 1 occurence.

  • RE: Importing into SQL Server from Excel

    Have you been able to work out a pattern - if you look back at the source data, do the fields that come through as nulls have anything in common?

    When you...

  • RE: Determining row numbers in recordset

    So you want the first column of a returned recordset to be row number?  Not straightforward via T-SQL (although I'll wait for someone here to prove me wrong!).  I would...

Viewing 15 posts - 13,351 through 13,365 (of 13,849 total)