Forum Replies Created

Viewing 15 posts - 4,801 through 4,815 (of 8,731 total)

  • RE: Trying to use T-SQL to calculate elapsed time

    sgmunson (6/19/2015)


    With SQL 2012, the query can actually be simplified:

    DECLARE @Spec1 AS TABLE (

    Spec1ID int IDENTITY(1,1) NOT NULL PRIMARY KEY CLUSTERED,

    Channel int NOT NULL,

    [Timestamp] datetime NOT NULL,

    Lambda decimal(8, 2) NOT...

  • RE: Help in query

    First attempt on getting this query working using Sean's sample data.

    WITH cteCs AS(

    select *,

    ROW_NUMBER() OVER(PARTITION BY [Week],...

  • RE: Select * not returning all columns in UDF

    ScottPletcher (5/13/2015)


    Before that you may want to try:

    EXEC sp_refreshview

    on that view.

    You mean sp_refreshsqlmodule because it's a UDF. 😉

  • RE: Removing blank address lines

    You could also correct the source if at all possible,

    Here's an example using AdventureWorks2012

    SELECT a.AddressID,

    a.AddressLine1,

    a.AddressLine2,

    a.City,...

  • RE: Another Rows to Columns question

    I posted 2 options. The first is called cross tabs and the second one uses the PIVOT operator.

    You can read more about this approaches in here: http://www.sqlservercentral.com/articles/T-SQL/63681/

    I also posted...

  • RE: Another Rows to Columns question

    Just remember that there's no order inside a table. There's an order inside a flat file, but there's no certainty that SQL Server will load it in the same order.

    That...

  • RE: Another Rows to Columns question

    How do you identify each group that you're converting to a row? You're missing the E on your EAV design.

  • RE: converting fahrenheit to celsius

    You need to pay more attention to details.

    You are missing one parenthesis in your second option and the target data type in the first one.

    The precision in decimal indicates the...

  • RE: Hepling with query getting the most recent record

    This can be solved by adding one more ROW_NUMBER() function to create groups based on the SalesRep.

    WITH

    cteCust (RowNum, CustomerNumber, Division, SalesRepType, SalesRepNumber, BeginDate)

    AS

    (

    SELECT

    ROW_NUMBER() OVER (PARTITION By CustomerNumber, Division, SalesRepType...

  • RE: converting NULL

    Lynn Pettis (6/16/2015)


    SolveSQL (6/16/2015)


    Appreciate the response.

    Basically, it is the same reason just not positional based. All values returned in the CASE statement must be of the same data type....

  • RE: Are the posted questions getting worse?

    TomThomson (6/16/2015)


    dwain.c (6/15/2015)


    Here's one for the hard-core Sci-Fi fans out there:

    Size Comparison - Science Fiction Spaceships

    Count me among 'em.

    Why no Dahak?

    I couldn't even find the Millenium Falcon.

  • RE: Problem in procedure

    You're doing an inner join with Table3. Are you sure that Table3 has the rows needed?

  • RE: Problem in procedure

    Ed Wagner (6/16/2015)


    ChrisM@Work (6/16/2015)


    j.grimanis (6/15/2015)


    Hi,

    I have a procedure which inside I call two other Procedures, the first one is updating table Purchase Order and the second one is updating an...

  • RE: Previous Years Report

    gazy007 (6/16/2015)


    Thanks Luis,

    I managed to change and get this working so far

    "ELECT

    CompanyName, CustomerAccount.AccountNumber ,

    SUM( CASE WHEN YEAR( DateEntered) = YEAR(DATEADD(YY, -4, GETDATE())) THEN (SalesLine.OrderQuantity*SalesLine.SellingPrice...

  • RE: Problem in procedure

    j.grimanis (6/16/2015)


    The second procedure( which does not work correct some times) is being executed after a "Commit Transaction" inside the first proc. Is there a possibility that rows are...

Viewing 15 posts - 4,801 through 4,815 (of 8,731 total)