Forum Replies Created

Viewing 15 posts - 1,531 through 1,545 (of 2,648 total)

  • Reply To: Things to be considered while tuning an UPDATE statement

    ScottPletcher wrote:

    If you only need to lookup consolidation_ind if it is = 1, then create a filtered index on ( consolidation_ind, party_id ) WHERE consolidation_ind = 1. Cluster table #party_id...

  • Reply To: Things to be considered while tuning an UPDATE statement

    If you haven't already created an index on your temporary table it might speed processing up if you add one before doing this update:

    CREATE INDEX IX_#party_id_1 ON...
  • Reply To: date yyyy-dd-mm in SQL 2016?

    datsun wrote:

    Jonathan/Thom, You both are right actually. We have many scripts with dates in dd/mm/yyyy and yyyy-mm-dd format. Plus we have to change few staff members login to English login...

  • Reply To: Indexing for View Containing UNION

    Thom A wrote:

    As you discovered, you can't index a View that has a UNION in it. In truth, if you need this type of design it does indicate a design flaw;...

  • Reply To: date yyyy-dd-mm in SQL 2016?

    Thom A wrote:

    Languages are there for a reason, and they do have impacts on  "simple" things such as the date here. The important part is that you code appropriately and therefore...

  • Reply To: eroor in value datetime

    John Esraelo-498130 wrote:

    I have run your script and this is the result I got, so, not sure how you got that error. 2019-01-31 00:00:00.007

    Try this:

    set language french;
    use tempdb;
    declare...
  • Reply To: date yyyy-dd-mm in SQL 2016?

    Thom A wrote:

    Jonathan AC Roberts wrote:

    I would just change the language of the login to from British to English to fix it though.

    Is that really the solution? Applications, and code, should be...

  • Reply To: date yyyy-dd-mm in SQL 2016?

    datsun wrote:

    Jonathan, Is this a change in SQL2016? Because the format yyyy-mm-dd behaves perfectly fine in SQL 2008 R2. I ran your set of correct/incorrect ones and the output changes...

  • Reply To: Indexing for View Containing UNION

    Just use a custom function as a constraint:

    CREATE FUNCTION dbo.chkTestSplitOwnership (@Item int, @Owner char(1))
    RETURNS int
    AS
    BEGIN
    DECLARE @retval int=0
    SELECT @retval =1
    WHERE...
  • Reply To: date yyyy-dd-mm in SQL 2016?

    Use '20180801' instead of '2018-08-01'

    If the columns on your table were datetime2 then it would also correctly convert the format you are using.

    set language british

    /* CORRECT CONVERSION...
  • Reply To: Partial Backups excluding a read/write filegroup?

    Jeff Moden wrote:

    I've done this but not the way you want.  It's super simple, though.  Create another database, move your large table to that, and create a synonym in the original...

  • Reply To: Column Names

    Just replace TestTable with your table name.

    DECLARE @TABLE_NAME sysname
    SET @TABLE_NAME = 'TestTable'
    SELECT @TABLE_NAME,
    STUFF((SELECT ', ' + COLUMN_NAME
    ...

    • This reply was modified 7 years, 2 months ago by Jonathan AC Roberts. Reason: Added more general query
  • Reply To: Need help with SQL joins

    Ysa wrote:

    I got duplicates, so I was trying to create CTE's

    There weren't any duplicates in the results of the code I supplied.

  • Viewing 15 posts - 1,531 through 1,545 (of 2,648 total)