Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sp-executesql-transact-sql.md #9823

Open
wants to merge 2 commits into
base: live
Choose a base branch
from

Commits on Jun 20, 2024

  1. Update sp-executesql-transact-sql.md

    There are way more than 12 statements generated. You get one statement for each year and month combination for each language where the first 3 characters of the month name are different.
    
    Personally, I think you would be better off using a table naming scheme that is not locale dependent like
    'Sales_' +
    cast(datepart(yy, @PrmOrderDate) as char(4)) +
    '_' +
    cast(datepart(mm, @PrmOrderDate) as char(2))
    
    To see the table names that you get now, run the following ...
    
    DECLARE @PrmOrderDate DATETIME;
    SET LANGUAGE N'us_english';
    SET @PrmOrderDate = '01/31/2021'; -- set date here because the date literal format also depends on LANGUAGE
    SELECT SUBSTRING(DATENAME(mm, @PrmOrderDate), 1, 3) + CAST(DATEPART(yy, @PrmOrderDate) AS CHAR(4)) + 'Sales';
    SET LANGUAGE N'Español';
    SELECT SUBSTRING(DATENAME(mm, @PrmOrderDate), 1, 3) + CAST(DATEPART(yy, @PrmOrderDate) AS CHAR(4)) + 'Sales';
    SET LANGUAGE N'ελληνικά';
    SELECT SUBSTRING(DATENAME(mm, @PrmOrderDate), 1, 3) + CAST(DATEPART(yy, @PrmOrderDate) AS CHAR(4)) + 'Sales';
    bpd0018 committed Jun 20, 2024
    Configuration menu
    Copy the full SHA
    c7ad5bc View commit details
    Browse the repository at this point in the history

Commits on Jul 22, 2024

  1. Configuration menu
    Copy the full SHA
    ae47f79 View commit details
    Browse the repository at this point in the history