SQL Server

Microsoft SQL Server powers your entire data estate by supporting structured and unstructured data sources. It builds on previous versions of SQL Server, which have been industry leading for four years in a row and a leader in TPC-E. It scales to petabytes of data and allows customers to process big data through PolyBase using T-SQL over any data. SQL Server has also been the least vulnerable database during the last seven years. SQL Server brings data insights with business intelligence capabilities that provide analytics at a fraction of the cost on any device along with advanced analytics with support for R and Python.

More details about SQL Server are available in the SQL Server documentation.
If you have a technical issue, please open a post on the developer forums through Stack Overflow or MSDN.


  • Hot ideas
  • Top ideas
  • New ideas
  • My feedback
  1. Cannot use external editor with SQLCMD

    SQLCMD returns the error below when the ED command is run to launch an external editor. Repro steps from a Windows command prompt below:

    C:\WINDOWS\system32>sqlcmd -?
    Microsoft (R) SQL Server Command Line Tool
    Version 14.0.3026.27 NT
    Copyright (C) 2017 Microsoft Corporation. All rights reserved.

    C:\WINDOWS\system32>SET SQLCMDEDITOR=notepad.exe

    C:\WINDOWS\system32>sqlcmd
    1> ED
    Sqlcmd: Error: Internal error at ExecProcess (Reason: The filename, directory name, or volume label syntax is incorrect).
    2>

    5 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Bugs  ·  Flag idea as inappropriate…  ·  Admin →
  2. Functions: return strings in else if are cut depending on other string returns

    Hello,

    after an upgrade to the newest docker version of SQL Server 19 (mcr.microsoft.com/mssql/server:2019-GA-ubuntu-16.04), previously we used SQL Server 2017 (mcr.microsoft.com/mssql/server:2017-latest), a function does not return the correct value anymore.

    Here is a simple Version of the function, which can reproduce the problem:

    ALTER FUNCTION [dbo].[testFunction] (@pVar nvarchar(50)) RETURNS nvarchar(50)
    AS
    BEGIN
    IF @pVar = N'a' begin

       return(N'a123456789');
    

    end ELSE IF @pVar = N'b' begin

       return(N'b12');
    

    end

    return(@pVar);
    END

    If you call following function with "SELECT [dbo].testFunction" the return is "a12", but i would expect "a123456789".

    It seems that the cut is dependent on the following return value,…

    5 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  Bugs  ·  Flag idea as inappropriate…  ·  Admin →
  3. Can't create DACPAC of a SQL Server 2019 DB with External ODBC Datasources

    when trying to extract a DACPAC for a SQL Server 2019 database with external datasources that use the new ODBC functionality in Polybase you get the following error (this happens both in Visual Studio 2019 and SSMS 18.3.1):

    TITLE: Microsoft SQL Server Management Studio

    Could not extract package from specified database.
    Error 0: An error occurred while attempting to reverse engineer elements of type Microsoft.Data.Tools.Schema.Sql.SchemaModel.SqlExternalDataSource: Unsupported external data source type '6'.
    (Microsoft.SqlServer.Dac)


    ADDITIONAL INFORMATION:

    Unsupported external data source type '6'. (Microsoft.Data.Tools.Schema.Sql)


    BUTTONS:

    OK

    5 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    5 comments  ·  Bugs  ·  Flag idea as inappropriate…  ·  Admin →
  4. Incorrect syntax error with CREATE EXTERNAL commands

    This applies to SQL 2019 RC1.

    First run this:
    exec sp_configure 'polybase enabled', 0
    reconfigure

    Then run this script:

    CREATE EXTERNAL DATA SOURCE MyAzureStorage

    WITH
    
    ( LOCATION = &#39;wasbs://<a rel="nofollow noreferrer" href="mailto:daily@logs.blob.core.windows.net">daily@logs.blob.core.windows.net</a>/&#39;
    , CREDENTIAL = AzureStorageCredential
    , TYPE = HADOOP
    )
    ;

    go
    CREATE EXTERNAL FILE FORMAT csvformat
    WITH (

    FORMAT_TYPE = DELIMITEDTEXT, 
    
    FORMAT_OPTIONS (
    FIELD_TERMINATOR = &#39;,&#39;
    )

    );
    go
    CREATE EXTERNAL TABLE [Avengers]
    (
            NAME nvarchar NOT NULL,
            LASTNAME nvarchar NULL,
            Email nvarchar NULL
    )
    WITH (DATA_SOURCE = PolyBaseDS)

    The output is:

    Msg 102, Level 15,…

    5 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Bugs  ·  Flag idea as inappropriate…  ·  Admin →
  5. function inlining

    In SQL Server 2019 function is marked as inlineable but it's not and query comes back with following error:

    Internal error: An expression services limit has been reached. Please look for potentially complex expressions in your query, and try to simplify them.

    Looks like SQL Server 2019 doesn't properly identify if function is inlineable and throws error vs just not inline it.

    5 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    3 comments  ·  Bugs  ·  Flag idea as inappropriate…  ·  Admin →
  6. Microsoft.SqlServer.TransactSql.ScriptDom.TSqlParser fails parsing simple valid expression

    There appear to be a bug in Microsoft.SqlServer.TransactSql.ScriptDom

    Here is a c# snippet:

    using Microsoft.SqlServer.TransactSql.ScriptDom;

    var parser = new TSql150Parser(true);

    string expr = @"IIF( (IIF(1 = 1, 1, NULL)) IS NULL, 1, 0)";

    var res = parser.ParseExpression(new StringReader(expr), out var errors);

    bool isSuccess = errors.Count == 0;

    Actual result: isSuccess is false
    Expected result: isSuccess is true

    5 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  Bugs  ·  Flag idea as inappropriate…  ·  Admin →
  7. Why does Find and Replace in SSMS 18.2 default to "All Open Documents"?!

    Why on earth does Find and Replace default to "All Open Documents"?!

    You don't know how many times I have replaced things in other query windows unintentionally. If I am fortunate, I catch it and do Ctrl-Z to undo it.

    Just now I did a replace, and SSMS froze while it happily did a replace in all the query windows I had open , to the tune of 63,514 replacements!

    A much more sensible default would be "Current Document". Or better yet, allow the default to be set under Tools... Options...

    Please change this.

    5 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  Bugs  ·  Flag idea as inappropriate…  ·  Admin →
  8. SSMS Find and Replace "Look In" values change without user input

    RE. Find and Replace "Look In" drop-down:
    Desired behaviors:

    * Default to "Current Document"
    * Retain selected option until dialog is closed & reopened -- do not change "Look In" without user input.

    Current behaviors:
    In both SSMS 17.9.1 (14.0.17289.0) and 18.2 (15.0.18142.0), the Find and Replace dialog defaults "Look in:" to "All Open Documents". I would suggest the default should be "Current Document" (which I believe was the default in older versions)
    Much more dangerously, even after changing the default to another option, "Look In" reverts to "All Open Documents", which can cause unintended, undesirable, & unknown changes to…

    5 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Bugs  ·  Flag idea as inappropriate…  ·  Admin →
  9. SQL Server 2017 bad cardinality estimate on simple query

    I use SQL Server 2017, and does the following query:
    SELECT *
    FROM
    TESTToBeTransferredTemp a
    inner join TEST
    codes c on a.type = c.idstring

    This produces a simple execution plan, where the query estimate is far off. It estimates 49,5 rows, but the actual number of rows is 8002.

    TESTToBeTransferredTemp.[type] column is a non-null foreignkey to TESTcodes.IDSTRING, which in turn has a unique index/constraint.
    That information alone should tell the optimizer that the join will produce 8002 rows exactly.

    That is one problem. But, even if we assume and accept that the foreign-key and unique constriant arent…

    5 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Bugs  ·  Flag idea as inappropriate…  ·  Admin →
  10. SSMS: Export of SSIS Project into ispac from Server doesn't wor

    when using the export function for an ssis project in SSMS 18.2 an error message comes up. The export fails and results in an an empty ispac file. Exporting the same project from the same server works with SSMS 17.9.1 but not with 18.2

    Info of SSMS which fails:
    SQL Server Management Studio 15.0.18142.0
    Microsoft Analysis Services Client Tools 15.0.1389.0
    Microsoft Data Access Components (MDAC) 10.0.14393.0
    Microsoft MSXML 3.0 4.0 6.0
    Microsoft Internet Explorer 9.11.14393.0
    Microsoft .NET Framework 4.0.30319.42000
    Operating System 10.0.14393

    ===================================

    Version of SSMS that succeeds:
    Microsoft SQL Server Management Studio 14.0.17289.0
    Microsoft Analysis Services Client Tools 14.0.1016.283 …

    5 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Bugs  ·  Flag idea as inappropriate…  ·  Admin →
  11. SSMS 18.2 - Can't copy text from find and replace window

    When I try to copy text from the find and replace window it fails with the message: "Unsaved documents cannot be cut or copied to the clipboard from the Miscellaneous Files project. You must save the unsaved document(s) before cutting or copying them." See attached screenshot.

    Text in the find/find and replace windows should always be copyable, regardless of whether the document has been saved or not.

    5 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    3 comments  ·  Bugs  ·  Flag idea as inappropriate…  ·  Admin →
  12. SSMS 18.1 issue

    When editing job step details
    (Open a job in Job activity monitor, go to Steps tab and edit job step),
    The SSMS hang and wait ~30-60 seconds before it opens the step details window.

    It happnes on every SQL engine I connect to, regardless the engine's version.
    It didn't happen on SSMS 17.9.

    My desktop is Windows 10 Enterprise 64bit.

    5 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  Bugs  ·  Flag idea as inappropriate…  ·  Admin →
  13. ssms 18.0 - extended events - watch live data - filter dropdowns fail

    After setting up an extended events session, choosing to watch live data, I want to add a filter.
    In the filter dialog box I need to choose 'Field', 'Operator' and 'Value'.
    Both 'Field' and 'Operator' have dropdowns and when I attempt to click the dropdown, instead of showin the options the dropdown menu flashes in the upper right corner of my screen.
    I end up using the arrows on my keyboard to find the option I want

    SQL Server Management Studio 15.0.18118.0
    Microsoft Analysis Services Client Tools 15.0.1300.131
    Microsoft Data Access Components (MDAC) 10.0.14393.0
    Microsoft MSXML 3.0 6.0
    Microsoft Internet…

    5 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  Bugs  ·  Flag idea as inappropriate…  ·  Admin →
  14. SQL server Import and Export Wizard missing/disabled SSMS 18.0

    SQL Server import and export is disabled in SSMS 18.0, is this temporary and available in later versions of 18 or we wouldn't have import export going forward?

    5 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    4 comments  ·  Bugs  ·  Flag idea as inappropriate…  ·  Admin →
    started  ·  Matteo Taveggia responded

    This is indeed an unintended removal. It only affected SQLEXPRESS.
    Thanks for the reporting it.
    We’ll fix it in a future release of SSMS 18.×.

  15. SQL 2019 CTP 2.4 Bug when querying a view which contains a [inline] scalar function which calls another [inline] scalar function.

    We are getting the following error in SQL 2019 CTP 2.4:

    Msg 596, Level 21, State 1, Line 1
    Cannot continue the execution because the session is in the kill state.
    Msg 0, Level 20, State 0, Line 1
    A severe error occurred on the current command. The results, if any, should be discarded.

    Turning off inlining for the database (ALTER DATABASE SCOPED CONFIGURATION SET TSQLSCALARUDF_INLINING = OFF), or redefining the functions using WITH INLINE = OFF fixes the issue.

    Is this a known limitation with inline functions? Or, could be this specific to our scalar functions?

    5 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    2 comments  ·  Bugs  ·  Flag idea as inappropriate…  ·  Admin →
  16. SSMS: Object Explorer Filtering allows for SQL Injection (oops)

    When applying filters in Object Explorer (in any "Filter Settings" dialog) in SSMS 17.9.1 and 2018 Preview 6 (and possibly versions prior to 17), it is possible to inject SQL into the query executed by SSMS, simply by using a single quote / apostrophe. Yes, the app code clearly escapes a single apostrophe into two apostrophes, but the string containing the apostrophe is concatenated into a Dynamic SQL string executed via sp_executesql. The string entered via the UI to filter on is intended to be used within a string literal within the Dynamic SQL string. In this case I filtered…

    5 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    6 comments  ·  Bugs  ·  Flag idea as inappropriate…  ·  Admin →
  17. Registered Server modifications via SQLServer PowerShell module bug

    There is an apparent bug in version 21.1.18068 of the SQLServer PowerShell module when creating Registered Servers groups and registrations. When created at the PowerShell prompt they are not reflected in the Registered Servers window (even after refresh, or reboot). Existing groups and registrations seen in the Registered Servers window are not available at the Powershell prompt using commands such as dir or Get-ChildItem.

    The commands I use to create groups and registrations at the PoweShell prompt are similar to:

    group

    New-Item -Path "sqlserver:\SQLRegistration\Database Engine Server Group\AllServers"

    registration

    New-Item -Name $(encode-sqlname 'sqlsrv') -path "sqlserver:\SQLRegistration\Database Engine Server Group\AllServers" -ItemType Registration -Value…

    5 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  Bugs  ·  Flag idea as inappropriate…  ·  Admin →
    planned  ·  Matteo Taveggia responded

    Thanks for the suggestion. We are going to take a look and get back to you.

  18. SSMS 18.0 Preview 5 - Cannot access a disposed object TaskFormDialogHost

    From Object Explorer right click on a specific index, select properties, select view connection properties, I get the following error message: Cannot read property HostDistribution. This property is not available on SQL Server 2016.

    After this error message has been displayed the Index Properties window becomes inaccessible, any time I try to open it I get this error message: Cannot access a disposed object. Object name: 'TaskFormDialogHost'. (System.Windows.Forms)

    Here are stack traces for both errors:

    ===================================

    Cannot read property HostDistribution. This property is not available on SQL Server 2016. (Microsoft.SqlServer.Smo)


    For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=15.0.18068.0+((SSMS_Rel).181113-0617)&EvtID=HostDistribution&LinkId=20476


    Program Location:

    at Microsoft.SqlServer.Management.Smo.SqlPropertyMetadataProvider.PropertyNameToIDLookupWithException(String propertyName, PropertyAccessPurpose…

    5 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    0 comments  ·  Bugs  ·  Flag idea as inappropriate…  ·  Admin →
  19. T-SQL Comment throwing a syntax error

    If you execute this T-SQL comment:

    --(*
    

    SQL Server will throw an error:

    Msg 102, Level 15, State 1, Line 36
    
    Incorrect syntax near &#39;--(*&#39;.

    I don't see anything in the documentation for "--" that would lead me to believe that SQL Server parses anything after the two dashes (https://docs.microsoft.com/en-us/sql/t-sql/language-elements/comment-transact-sql?view=sql-server-2017)

    What's going on?

    5 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    2 comments  ·  Bugs  ·  Flag idea as inappropriate…  ·  Admin →
  20. SQL Server CU Upgrade breaks MDS within an AG and cannot upgrade DB due to "distributed transaction"

    Pretty much as the title - currently we have MDS as part of an AG on SS 2017. Every single time we do a CU it breaks MDS and the MDS Configuration Tool Cannot upgrade the DB as required because it is part of a "distributed transaction" - we have to remove from AG, upgrade, backup, and import into secondary server and then readd to AG. Please can you fix this!?

    5 votes
    Sign in
    (thinking…)
    Sign in with: Microsoft
    Signed in as (Sign out)

    We’ll send you updates on this idea

    1 comment  ·  Bugs  ·  Flag idea as inappropriate…  ·  Admin →
  • Don't see your idea?

SQL Server

Categories

Feedback and Knowledge Base