Forum Replies Created

Viewing 15 posts - 1,906 through 1,920 (of 7,619 total)

  • Reply To: Replacing String Between Two HTML Tags

    Could do this with recursion, from right to left, but for now I'll just do a simple cursor loop.  Hopefully that will perform well enough for what you need.  Naturally...

    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".

  • Reply To: Convert International Character-String Date Formats

    Or just make sure they send a string that is valid for conversion in the language they are using!

    If I write '25 dek 2020' in English, then that's my error,...

    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".

  • Reply To: Stored Proc:Can I use a parameter of comma separated Id\'s within a WHERE clause?

    Jeffrey Williams wrote:

    ScottPletcher wrote:

    You will NOT get dup rows from dup values in an IN clause.  Easy enough to verify:

    CREATE TABLE #t1 ( col1 int NOT NULL )
    INSERT...

    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".

  • Reply To: Convert International Character-String Date Formats

    Either you to do it by CASTing/CONVERTing one language at a time, or have them include a language code in the file.

    You could, though, use CASE so that you could...

    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".

  • Reply To: Stored Proc:Can I use a parameter of comma separated Id\'s within a WHERE clause?

    Jeffrey Williams wrote:

    ScottPletcher wrote:

    Jeffrey Williams wrote:

    ScottPletcher wrote:

    Jeffrey Williams wrote:

    You don't have to use replace - the string will be converted (implicitly) to an integer for comparison so any leading/trailing blanks will not affect...

    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".

  • Reply To: Stored Proc:Can I use a parameter of comma separated Id\'s within a WHERE clause?

    Jeffrey Williams wrote:

    ScottPletcher wrote:

    Jeffrey Williams wrote:

    You don't have to use replace - the string will be converted (implicitly) to an integer for comparison so any leading/trailing blanks will not affect that conversion.

    You...

    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".

  • Reply To: Stored Proc:Can I use a parameter of comma separated Id\'s within a WHERE clause?

    Jeffrey Williams wrote:

    You don't have to use replace - the string will be converted (implicitly) to an integer for comparison so any leading/trailing blanks will not affect that conversion.

    You can also...

    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".

  • Reply To: Why I have problem with adding IDENTITY in my table?

    In the original version, try putting brackets around the column name "Kolicina".  It looks like you might have a non-standard character in the name.

    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".

  • Reply To: Stored Proc:Can I use a parameter of comma separated Id\'s within a WHERE clause?

    I'd stick with temp tables.  And it can't hurt -- and could help -- to use a PK in the temp table (or table variable).


    DROP TABLE IF...

    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".

  • Reply To: DATEPART(week ...) displaying wrong week number

    See if these calcs give you results more like what you want.

    Edit: Note that the calcs are completely independent of any/all date and language and DATEFIRST setting and will work...

    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".

  • Reply To: Query optimization

    Jeff Moden wrote:

    But, changing the clustered index without knowing "the rest of the story" may have a devastating impact on other much more important code.

    If you build nonclustered indexes as necessary,...

    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".

  • Reply To: DATEPART(week ...) displaying wrong week number

    If you tell us what you consider to be a "week" -- as we asked for several times -- we could give you code specific to your needs.

    I wouldn't rely...

    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".

  • Reply To: Query optimization

    Well, obviously, I don't consider it "stupid".  Remember, the DELETEs are almost twice a minute.  If the table has to be scanned in order to do the deletes, that would...

    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".

  • Reply To: SELECT * INTO Using a Select Statement

    You're welcome.  Yeah, SQL requires the alias name (the "AS" is not required, I just like to use it but the "any_name" part is required).

    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".

  • Reply To: SELECT * INTO Using a Select Statement

    You need parentheses to "tell" SQL you're using a subquery in the SELECT:

    SELECT * INTO temp_Weekly_Event_Report FROM
    (
    SELECT

    DISTINCT column1 FROM [SQLDatabase].[dbo].[Table] WHERE Event_Source = 1
    ) AS any_name

    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 - 1,906 through 1,920 (of 7,619 total)