Forum Replies Created

Viewing 15 posts - 76 through 90 (of 345 total)

  • RE: Creating a sum column without losing records

    Skinning cat method #2:

    select * from #orders o

    cross apply (

    select OrderNumber, SUM(total) OrderTotal

    from #orders

    where OrderNumber = o.OrderNumber

    group by OrderNumber) a

  • RE: How to determine hung process?

    Yep, all good. Thanks.

  • RE: Trigger into SPROC

    Did it help the last time we worked on this proc?

    http://www.sqlservercentral.com/Forums/Topic1218042-392-1.aspx

  • RE: How to add the numbers in T-SQL

    salum (12/19/2011)


    it will allow to do the addition if the data type is numeric. if column data type is char it will just contaminate.

    Only if the table contains biological wastes....

  • RE: How to determine hung process?

    GilaMonster (12/19/2011)


    Have you looked at the wait type and resource? (of both that function and any other query you run)

    Is the CPU bottlenecked?

    Is that functionality written optimally? Are there good...

  • RE: How to get the table name in the trigger definition

    lookatjks (12/15/2011)


    ...but is it possible to get the table name dynamically on which the trigger is defined in order to avoid hard coding the table name...

    SELECT OBJECT_NAME(parent_object_id)

    FROM sys.objects

    WHERE...

  • RE: sql server cursor

    omalie24 (12/14/2011)


    HEY....IT WORKS...BUT I NEEDED IT TO CYCLE THROUGH MULTIPLE ROWS OF DATA WHICH HAS DIFFERENT SERIAL NUMBERS.....I KINDA FIXED IT.....I KNOW U WOULDNT LIKE THIS BUT I WRAPPED...

  • RE: sql server cursor

    Ok, here is a way to do this with using a loop. I'm showing this way because I think you will understand this the most. You should in general avoid...

  • RE: sql server cursor

    omalie24 (12/13/2011)


    the data type in the first table is like that as a result of me importing the data from a excel sheet

    Ok, but understand that if you want to...

  • RE: sql server cursor

    omalie24, this is the type of info we need to help you. I typed this up to get you started.

    create table [dbo].[Test_Sales] (

    [TRAN_DATE] varchar(10),[ITEM_CODE] varchar(20), [SERIAL_NUMBER] bigint,

    [CUSTOMER_NUMBER] varchar(20), [CUSTOMER_NAME] varchar(20),[QUANTITY]...

  • RE: sql server cursor

    Sean Lange (12/13/2011)


    toddasd (12/13/2011)


    omalie24 (12/13/2011)


    ...every field stays the same except for the on being incremented....see code that i have below...it inserts first letter of each column and loop doesnt break..

    That's...

  • RE: sql server cursor

    omalie24 (12/13/2011)


    ...every field stays the same except for the on being incremented....see code that i have below...it inserts first letter of each column and loop doesnt break..

    That's because all the...

  • RE: Stored Proc in MS ACCESS Database Project With MS SQL Server 2008R2

    In Access VBA, he is the basic way to call a proc:

    Dim rs As New ADODB.Recordset

    rs.Open "dbo.StoredProcedure1 " & [Forms]![AcftSelect]![cboSA], CodeProject.Connection, adOpenForwardOnly

    'do stuff

    rs.Close

    Just concatenate the proc name and the parameters.

    Edit:...

  • RE: Case Statement and ISNULL problem

    Nevermind that one, think I got it. Check that any of the dates in the table are before 1753:

    SELECT *

    FROM dbo.Names

    WHERE DateOfLicense1 < '01-Jan-1753'

    OR DateOfLicense2 < '01-Jan-1753'

    OR DateOfLicense3...

  • RE: Case Statement and ISNULL problem

    Also, if your columns are char based, then you may have an invalid date. Run this to find it:

    SELECT *

    FROM dbo.Names

    WHERE ISDATE(ISNULL(DateOfLicense1,CAST('01-DEC-2015' AS DATETIME)))=0

    OR ISDATE(ISNULL(DateOfLicense2,CAST('01-DEC-2015' AS DATETIME)))=0

    OR ISDATE(ISNULL(DateOfLicense3,CAST('01-DEC-2015'...

Viewing 15 posts - 76 through 90 (of 345 total)