Forum Replies Created

Viewing 15 posts - 3,046 through 3,060 (of 4,087 total)

  • RE: Declared Hard coded Variables

    You should not be using the arithmetic subtraction operator to calculate differences between date or time expressions. Subtract will only work with the old DATETIME and SMALLDATETIME data types....

  • RE: sp_getrecords to get all records from a table

    What he's trying to do is set up a key code to run a procedure, so that he can highlight a section of text in a query and hit the...

  • RE: Gettin Error while Inplorting data from excel file to Table in sqlserver.

    First, this is an SSIS issue, not a T-SQL question, so it should really be posted in the SSIS forum.

    The problem is that Excel determines the field lengths/types by sampling...

  • RE: Importing XML file into SQL 2008R2...nearly there

    Fuel type is stored in an attribute of the Fuel element, so you need to give the path to that attribute rather than referencing the element itself.

    c3.value('@type', 'varchar(30)') AS [Fuel...

  • RE: Dynamic Sorting Issue

    Slightly shorter

    DECLARE @Sort1 varchar(10)='val3'; --NOTE: @Sort2 ommitted from this example because I am still stuck on @sort1

    --DECLARE @Sort1 varchar(10)='val3';

    DECLARE @x TABLE (val1 varchar(10) not null, val2 varchar(10) not null,val3 int);

    INSERT...

  • RE: Display SQL result like Quick Search format

    WITH ROLLUP is being deprecated in favor of the ROLLUP() function. Here is the query rewritten using the ROLLUP() function.

    ;WITH CTE0 AS

    (

    SELECT Section

    ,NAME

    ,RowOrdering = ROW_NUMBER() OVER (ORDER BY Section,...

  • RE: XML issue converting table to XML

    First, your XML is not valid. You can only assign values to attributes and you are trying to assign them to the tag.

    <TOP_LEVEL_ITEM= "TOP LEVEL TYPE A" TOP_LEVEL_ID="294">

    This needs...

  • RE: Best way to insert into two related tables?

    Jeff Moden (2/15/2013)


    OTF (2/15/2013)


    You can also take a look at using OUTPUT.

    I've found that to be a wee bit more difficult than you would think unless you have an alternate...

  • RE: Maximum Concurrent Users in a day

    The solution provided in your link is likely to be the fastest. (It essentially the same as what Paul is suggesting, but limiting the buckets to only the specific...

  • RE: All Possible Combinations Loop

    akberali67 (2/8/2013)


    Are Rollup and Cube stored procedures because sql doesnt seem to be recognizing them. I am using SQL Server 2005, maybe thats the problem?

    No, but the syntax was changed...

  • RE: Update a table based upon CTE data

    MyDoggieJessie (2/8/2013)


    Yes, good catch. Based upon Lynn's suggestion I changed the code to store the data from the CTE's locally...so now I do use both CTE's as I insert...

  • RE: Update a table based upon CTE data

    You're not using the Txn CTE anywhere in your UPDATE statement, so you can drop it without changing the results of your query. I believe that is the worktable...

  • RE: Trying to understand ISDATE & CAST behavior

    ScottPletcher (1/21/2013)


    Huh? I don't see anywhere a "datetime" data type is specified, only varchar. I don't see why the code couldn't run fine as is.

    I guess your...

  • RE: Something Most Likely Simple

    GilaMonster (1/17/2013)


    Also, since this is SQL 2008, have a read up on Grouping Sets. They allow a lot more flexibility than cube and rollup do.

    Especially since WITH CUBE and WITH...

  • RE: When can I use an alias?

    Your attached query has a similar problem. The optional FROM clause in a SELECT statement is the same as in a DELETE statement.

    1) The FROM keyword...

Viewing 15 posts - 3,046 through 3,060 (of 4,087 total)