Forum Replies Created

Viewing 15 posts - 1,366 through 1,380 (of 2,894 total)

  • RE: much worse execution plan calling stored procedure vs. query window

    This kind of question appears on SQL forums quite often...

    There are few possible reasons for this to happen, parameter sniffing is one of them.

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: unique constraint

    ...

    I like the idea of having a sid (a surrogate id) on my tables, even if I do have a natural key that can serve as a primary key. ...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: "UPDATE" Is Not Updating Correctly

    In your case you can use:

    ;WITH SUM_SALES_SUMMARY

    AS

    (

    SELECT CSCODE AS CSCODE

    ...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: unique constraint

    Some people will tell you that you should always use natural keys (JC the master of them :-)) and others will tell you that you should always use surrogate keys....

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Remove non alphabetic characters but retain (space, single quote and dash)

    Use this:

    '%[^a-z ''^-]%'

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: repeating value in a case statement?

    Sector7G (8/10/2012)


    Hello,

    I’d like to confirm if what I am attempting is possible. I suspect it’s not, but wanted to ask. I am trying to re-write a query that...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: "UPDATE" Is Not Updating Correctly

    You should learn about aggregate functions.

    In your case you will need to use SUM()

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Intresting Query

    I guess to answer OP given question any of T-SQL solution would do, I also think that interviewer will be looking for answer in SQL. I wouldn't go with...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Intresting Query

    I don't have VS to test...

    try:

    using System;

    using System.Data;

    using System.Data.SqlClient;

    using System.Data.SqlTypes;

    using Microsoft.SqlServer.Server;

    using System.Text.RegularExpressions;

    public partial class UserDefinedFunctions

    {

    static readonly Regex _regex = new Regex(@"[^0][0-9]*[^0]", RegexOptions.Compiled);

    ...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Intresting Query

    try to return

    (SqlString) s.Value.TrimStart('0').TrimEnd('0');

    instead of

    new SqlString(s.Value.TrimStart('0').TrimEnd('0'));

    what about Regex?

    Don't forget to create static Regex object instead of instance in the function.

    To remove leading and trailing...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Intresting Query

    ...

    Possibly so, although I can confirm that PATINDEX does not.

    You cannot even remotely compare performance of PATINDEX and .NET Regex...

    PATINDEX can only find the pattern in the string, but to...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Precedence of operator in SQL

    ...

    Wow, I'm glad I don't have to debug your code:-D

    Yeah,

    you better not

    debug my code

    without note

    it can explode!

    :hehe:

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: XML Statement

    You can find a most of details about this one in BoL.

    Usually this one is used for aggregation-like string concatenation...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Intresting Query

    dwain.c (8/10/2012)


    Eugene Elutin (8/10/2012)


    You should try CLR too...

    Hah! I was waiting to hear someone suggest that. Not surprised it was you.

    Where have you been lately Eugene? Haven't...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

  • RE: Intresting Query

    You should try CLR too...

    _____________________________________________
    "The only true wisdom is in knowing you know nothing"
    "O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!":-D
    (So many miracle inventions provided by MS to us...)

    How to post your question to get the best and quick help[/url]

Viewing 15 posts - 1,366 through 1,380 (of 2,894 total)