Forum Replies Created

Viewing 15 posts - 16 through 30 (of 355 total)

  • RE: Proc Performance

    There are several problems with your procedure and the "WHERE (1 = 1)" clause is not really one of them.

    You should always declare the length of any varchar, nvarchar, char...

  • RE: How to split a single record in multiple records based on a datetime period?

    Thanks Jeff for following this up.

    --Andrew

  • RE: Data Trimming Issue

    If the column datatype is of character type

    STUFF(MyColumn, 6, 0, '-')

    If the column datatype is of integer type

    STUFF(CAST(MyColumn AS varchar(10)), 6, 0, '-')

  • RE: Get count for each row

    Use RANK() instead of ROW_NUMBER()

    RANK() OVER(ORDER BY Value) - 1

  • RE: How to split a single record in multiple records based on a datetime period?

    Assuming a table with this structure:

    CREATE TABLE #MyTable (

    equipment varchar(20) NOT NULL,

    date_start datetime NOT NULL,

    date_end datetime NOT NULL

    )

    And some test data...

  • RE: Script to Generate current_Id based on Parent value

    Narendra-274001

    I just noticed the other thread in the T-SQL 2008 forum.

    PLEASE don't cross post - you just waste people's time.

  • RE: Script to Generate current_Id based on Parent value

    Here's a script for providing data in an easily consumable format. I've made some assumptions about your table structure.

    CREATE TABLE #MyTable (

    ID INT NOT NULL PRIMARY KEY,

    ...

  • RE: Float numbers

    Here's an alternative query based on method 2 of my previous post, but uses a recursive CTE instead of a WHILE loop. I haven't compared the various methods for performance.

    DECLARE...

  • RE: Float numbers

    This isn't really something that TSQL is well suited for, since the various solutions require an iterative approach. However, if you want to find the modulus of a large integer...

  • RE: Insert into syntax

    I'm not sure what you are trying to do. If you are trying to copy column values from one table to another where ID columns in the two tables match,...

  • RE: Transpose Verticle to Horizontal

    You need a pivot query. You can use the PIVOT syntax or do something similar to the query below.

    I've assumed this table structure, so you will have to adapt the...

  • RE: Insert into syntax

    Sorry. - I just noticed that this is the Access forum. My comment above assumed it was for SQL Server. However, what I said should hopefully be relevant to Access,...

  • RE: Insert into syntax

    Don't take those square brackets in the formal syntax description of INSERT in Books Online too literally, but if you insist on using table and column names with spaces (why?),...

  • RE: Joining Same tables

    Are you interested in 2010 rows only if they match another 2009 row on the Value column? Or are you also interested in 2010 rows that have no matching 2009...

  • RE: Round to next 1000 or 100 without Ceiling function

    Jeff Moden (12/15/2010)


    andrewd.smith (12/15/2010)


    Jeff Moden (12/15/2010)


    parthi-1705 (12/13/2010)


    But i want to know only CEILING can do this or some other functions can do this or not

    Thanks

    Parthi

    CEILING is the way people...

Viewing 15 posts - 16 through 30 (of 355 total)