Forum Replies Created

Viewing 15 posts - 376 through 390 (of 761 total)

  • RE: Need help on transposing rows into columns

    This might help:

    --Creating Table

    CREATE TABLE Ex

    (

    [Task] [varchar](10) NULL,

    [WeekStart] [date] NULL,

    [PercentageProductivity] [int] NULL)

    --Inserting Sample Data

    Insert Into Ex

    Select 'Task1', '2012/05/19', 40

    Union ALL

    Select 'Task1', '2012/05/26', 100

    Union ALL

    Select 'Task2', '2012/05/26', 30

    Union ALL

    Select 'Task2', '2012/06/02',...

  • RE: Multiply two columns in SQL nd store

    You can use a CTE to update your table as follows:

    --Creating Table

    Create Table Ex1

    (idint,

    product int,

    price int,

    qty int,

    total int)

    --Inserting Sample Data

    Insert Into Ex1(id, product, price, qty)...

  • RE: from query results I need to group distinct data that has records in common.

    This might help:

    --Creating Table

    Create Table Ex1

    (Col1 int,

    Col2 char(1) )

    --Inserting Sample Data

    Insert Into Ex1

    Select 1, 'a'

    Union ALL

    Select 2, 'a'

    Union ALL

    Select 1, 'b'

    Union ALL

    Select 3, 'c'

    Union ALL

    Select 1, 'd'

    Union ALL

    Select 2,...

  • RE: insert values in table

    riya_dave (5/29/2012)


    thanks everyone

    You're welcome 🙂

  • RE: Conditional Aggregation

    sridhar_kola (5/29/2012)


    I think you have not understood the requirement. Your CTE will give the difference between previous and current time. But the requirement is to get the time difference from...

  • RE: Conditional Aggregation

    sridhar_kola (5/29/2012)


    Lets say I have a table as

    MIDTime (Hh:Mm)

    M110:22

    M112:15

    M113:22

    M116:00

    M117:50

    I need to aggregate the counts for MID(M1) based on the condition "to aggregate values that are beyond 2 hrs window"

    So...

  • RE: In Memory Database

    You can't specifically create an in memory table in SQL Server.

    Why??

    Because, SQL Server uses an advanced caching mechanism that ensures that frequently accessed data will normally remain in the data...

  • RE: Use a second table to make selections from another table

    Yes, on a larger set of data your method works better.

    I had checked the stats on the same data set that the OP supplied....on that set the stats for both...

  • RE: Use a second table to make selections from another table

    You can also do it using simple sub queries:

    --Creating Tables

    Create Table Table1

    (ID int,

    SYMBOL varchar(10),

    DATE Date, PRICE Float,

    VOLUME int )

    Create Table Table2

    (ID int,

    SYMBOL varchar(10),

    COMPANY varchar(50),

    ...

  • RE: Nested & Correlated Queries

    Stewart "Arturius" Campbell (5/28/2012)


    Try using a LEFT JOIN instead

    +1 Stewart.

    LEFT JOIN would do it.

  • RE: How can i know which columns are ununsed in my table?

    Please explain about what "columns" you have in mind, and who is "using" them.

    Are you suggesting that some dynamic procedure is executing and you want to know which columns it...

  • RE: insert values in table

    This will work:

    --Creating table

    Create Table Ex

    (ac varchar(30) )

    --Insert Query For Your Requirement

    Insert Into Ex Values('Account''s Value')

    --Checking the Inserted Value

    Select * From Ex

  • RE: Replacement for Cursors

    I tried executing the following example from your link:

    CREATE TABLE #temp (DB sysname, [Schema] sysname, Routine sysname);

    INSERT INTO #temp

    EXECUTE OVER_SET '

    SELECT ROUTINE_CATALOG, ROUTINE_SCHEMA, ROUTINE_NAME

    ...

  • RE: Replacement for Cursors

    RBarryYoung (5/26/2012)


    vinu512 (5/4/2012)


    I give up...I've banged my head on this for really long....I have come to the conclusion that a loop cannot be avoided in this scenario.

    However un-SetBased( 😛 )...

  • RE: A cursor with the name 'CursorName' already exists.

    Is the Cursor being Deallocated after it has been used in the Trigger??

    EDIT: Sorry didn't read the original post.

    But, on second thought I would still ask the above question.

    You just...

Viewing 15 posts - 376 through 390 (of 761 total)