Forum Replies Created

Viewing 15 posts - 3,256 through 3,270 (of 4,087 total)

  • RE: FK referencing PK in *same* table

    Jeff Moden (3/30/2012)


    Heh... a Rose, by any other name, is still a Rose.

    Unless I'm mistaken, all of the examples above all boil down to some form of parent/child relationship.

    I'm not...

  • RE: Joining tables with two tables but displayed in only one row

    Use FOR XML PATH('') to concatenate your string together. There are several articles on how to do this. In my quick scan, this covered the basics well. Creating...

  • RE: FK referencing PK in *same* table

    Sure try the key phrase "foreign key". You act as if foreign keys to the same table are somehow mysteriously different from foreign keys to other tables, but they're...

  • RE: 2008 import from excel not allow to run immediately

    It's hard to give you any help without more details. For instance, you don't mention how you are copying your Excel file to the database—SSIS, OPENROWSET, etc.

    Drew

  • RE: sql query group by weekend

    A simple modification of my previous response will give you the results you want. Of course, including the HAVING clause excludes both of your records.

    DECLARE @QuarterEnd DATE = '2011-12-31'

    SELECT...

  • RE: sql query group by weekend

    I think that you are overcomplicating things by using the wrong aggregate. Instead of using COUNT(1) you should be using COUNT(DISTINCT <some expression>)

    I think this does the exact same...

  • RE: Data Extract

    dwain.c (3/26/2012)


    You can try something like this and but it will also match ABC in 0ABC (if this is what you want):

    DECLARE @clients TABLE (clientno VARCHAR(20))

    INSERT INTO @clients

    SELECT '55566' As...

  • RE: TOP 1 in an INNER JOIN query

    Did you try the CROSS APPLY? The only change will be that you need to change the WHERE clause to bo.userid = u.[id]

    Drew

  • RE: TOP 1 in an INNER JOIN query

    You'll want to use an APPLY. Since you're data doesn't match your current results, this is a pure guess at what you want.

    SELECT u.[ID], bo.BackOfficeID

    FROM Users AS u

    CROSS APPLY...

  • RE: we're throwing around using the image data type for a project we're doing

    Image has been deprecated. You should avoid using it in new development. Use varbinary(max) instead.

    Drew

  • RE: MAT Quarter

    jothibhatt_s (3/27/2012)


    I want to create a MAT quarter based on the below data and use it as an attribute in cube.

    I want to handle it in database instead of handling...

  • RE: replicating data with an ID

    That subject is too long for a forum post, but you can search the web for "database normalization". Some quick points

    * You have to search multiple fields instead of...

  • RE: Trying to aggregate from a 4 query UNION

    You don't say what you want it to be a function of. I assume jobkey and maybe date.

    My recommendation is DON'T use a scalar UDF. You will probably...

  • RE: Help with a query.

    Cadavre (3/26/2012)


    seth delconte (3/26/2012)


    REPLACE works too 😀

    SELECT id,Nivel,REPLACE(A,'0','')A,REPLACE(B,'0','')B...

    FROM @tblCron

    I try to avoid implicit conversions where possible

    The other thing is that it's not a general solution. Consider what would...

  • RE: replicating data with an ID

    You don't really want to create tables like that, because it makes your data much harder to work with. Sometimes you may need to output data in that format...

Viewing 15 posts - 3,256 through 3,270 (of 4,087 total)