Forum Replies Created

Viewing 15 posts - 5,056 through 5,070 (of 8,731 total)

  • RE: Incorrect Syntax error. But the generated query is good

    I'd completely remove the table variable (unless you use it somewhere else). And I would use the sys.databases view.

    SET NOCOUNT ON

    SELECT NAME,

    recovery_model_desc AS 'RECOVERY...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Table Join issue

    I'm using your same code but I don't get an error.

    CREATE TABLE tblHoliday( HolidayDate date);

    INSERT INTO tblHoliday

    VALUES('20150101'),

    ('20150425');

    CREATE TABLE tblPeriod( StartDate date, EndDate date);

    INSERT...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Storing Dynamic Query Output in Temp Table

    What about inserting it into a global temp table? Would that cause issues?

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Incorrect Syntax error. But the generated query is good

    You can't use GO inside a dynamic sql statement. GO isn't a T-SQL keyword, it's a batch generator interpreted by SSMS.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: JOIN Tables

    Or maybe you might need a LIKE in your JOIN clause.

    SELECT

    TB.DiaryID

    ,TA.MedicalCodeID

    FROM dbo.TableA TA

    JOIN dbo.TableB TB ON TB.EmisCode LIKE TA.EmisCode + '%';

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: SQL Server 2008 R2 error

    Does this help?

    http://answers.microsoft.com/en-us/windows/forum/windows_7-pictures/error-the-application-has-failed-to-start-because/df019c0d-746e-42d0-ad68-465e18e3f3ef

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Identity on Uniqueidentifier

    No, it's not possible.

    From BOL.

    The IDENTITY property can be assigned to tinyint, smallint, int, bigint, decimal(p,0), or numeric(p,0) columns. Only one identity column can be created per table.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: SQL Query - Possibly the most poorly written query in the history of mankind

    This is an awful query, but it's not just the query. The problem comes from the database design. I see a special problem on dbo.avoice_vw_TableDetail as it is completely denormalized.

    Another...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: removing duplicates

    As previously stated, you need to normalize your table. If you can't change the schema, you still need to code the normalization and denormalize again. Here's a sample on how...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Display dates between two dates

    Anshul Parmar (4/1/2015)


    If you don't have a calendar table or if you don't want to use a calendar table. Use CTE instead-

    ;WITH CTE AS

    (

    SELECT CAST('2015-03-01' AS...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Passing sql Variable how to get this to work ? getting some error

    What's the error? What are you trying to do?

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Correlated query to INNER JOIN or Window function

    As previously said, you can use a cross apply.

    I'm leaving both options. Note that the join needs to calculate all the values before joining and that's why it can be...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: script to find when index was created

    I had the same question some days ago and only found that the index creation affected the column modify_date in sys.objects. If the index supports a constraint, you could query...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Need Sample Data

    Maybe something here or here could help you.

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2
  • RE: Concatenate + Datetime conversion error

    Why are you concatenating the date with itself? What are you trying to do?

    There's no problem concatenating dates if you use CONVERT()

    DECLARE @SampleData TABLE(

    SomeDate date)

    INSERT INTO...

    Luis C.
    General Disclaimer:
    Are you seriously taking the advice and code from someone from the internet without testing it? Do you at least understand it? Or can it easily kill your server?

    How to post data/code on a forum to get the best help: Option 1 / Option 2

Viewing 15 posts - 5,056 through 5,070 (of 8,731 total)