Forum Replies Created

Viewing 15 posts - 4,921 through 4,935 (of 7,619 total)

  • RE: How to compare a list of values

    You can do it with a single pass thru the item_categories table -- I renamed the tables to reflect their contents. Data set up first, then the main query...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Outputting Sproc result set to a new physical table

    I've actually resorted to having some procs accept a special param value that "tells" the proc just to return the current create table command for its result table. Then...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Default Constraints NULL / Not NULL

    Use sys.columns rather than the information_schema views.

    select *

    from sys.columns c

    where cast(objectpropertyex(c.object_id, 'BaseType') as varchar(2)) = 'u' and c.is_nullable = 1 and c.is_computed = 0

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Put clustered index on 8 Column Natural Key, or on Identity Key

    BSharbo (8/3/2015)


    I can understanding adding an identity key to a table to facilicate joins to other tables.

    However in this instance there is only the one table.

    I guess I'm still a...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Delete duplicate rows from ANY table.

    ben.brugman (8/3/2015)


    This weekend I have been away from the keyboard. And as often the best idea's occure when away from the keyboard. E.g. on my bike (pushbike) or under the...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Delete duplicate rows from ANY table.

    Lynn Pettis (7/31/2015)


    ScottPletcher (7/31/2015)


    ZZartin (7/31/2015)


    ben.brugman (7/31/2015)


    Sean Lange (7/31/2015)


    You should avoid the sp_ prefix on your procedures. It is reserved for MS and denotes it as a system procedure. The performance...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: SELECT qualified employees based on program rrequirements

    Main SQL query in the bottom code box. But, I must stress again, to maintain data integrity and drastically help performance, you must:

    GET RID OF THE DOPEY AND DANGEROUS...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Delete duplicate rows from ANY table.

    ZZartin (7/31/2015)


    ben.brugman (7/31/2015)


    Sean Lange (7/31/2015)


    You should avoid the sp_ prefix on your procedures. It is reserved for MS and denotes it as a system procedure. The performance issues are mostly...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Delete duplicate rows from ANY table.

    Lynn Pettis (7/31/2015)


    Sean Lange (7/31/2015)


    ScottPletcher (7/31/2015)


    Technically "usp_" is illogical, since "sp_" stands for "special", but "usp_" wouldn't be meant as "user special".

    I would offer that a prefix of any kind...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: How can I check file extension efficiently?

    halifaxdal (7/31/2015)


    Can you explain '%[a-z]:%\%.%'? My first time to use it, thanks. Basically the sample data is sample only, the real data could be randomly and I have no idea...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: SELECT qualified employees based on program rrequirements

    SELECT pm_emp.ProgramID, pm_emp.EmployeeID, e.EmployeeName

    FROM (

    SELECT

    pm.ProgramID,

    eq.EmployeeID

    FROM tblProgramModules pm

    LEFT OUTER JOIN...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Delete duplicate rows from ANY table.

    Technically "usp_" is illogical, since "sp_" stands for "special", but "usp_" wouldn't be meant as "user special".

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: How can I check file extension efficiently?

    Maybe this will give you some ideas/alternatives:

    SELECT

    breach_content,

    RIGHT(breach_content, CASE WHEN SUBSTRING(breach_content, LEN(breach_content) - 3, 1) = '.' THEN 3 ELSE 4 END)...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: temporary tables (# tables) & tempdb

    You'll have to specify COLLATE on every column to which it applies.

    For example:

    CREATE TABLE #test ( col1 varchar(30) NOT NULL COLLATE Latin1_General_CI_AS, col2 int NOT NULL, col3 datetime NOT NULL,...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

  • RE: Union Join

    Get rid of the parentheses around the main queries -- those "tell" SQL that a subquery is coming, but these not subqueries.

    /*(*/

    Select distinct b.lev5

    from bf_data a

    inner join bf_orgn_cnsl_tbl b

    on a.bf_orgn_cd...

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".

Viewing 15 posts - 4,921 through 4,935 (of 7,619 total)