Where is the save location of a QGIS-layer-style in a mssql-server?

I am user in a larger mssql-server-database with read and write permissions in a specific schema. On saving the style for a layer in the mssql-database, I get this message:

"Unable to save layer style. It's not possible to create the destination table on the database. Maybe this is due to table permissions. Please contact your database admin"

Will the destination table for the layer style be saved in my user-schema or in a different place (e.g. dbo)?

  • You might find it in the error logs. Check the Speech bubble icon in the bottom right of QGIS. It should have a "MSSQL" tab. Nov 20, 2017 at 10:51
  • There is no MSSQL-tab!
    – vezzon
    Nov 20, 2017 at 11:17
  • Try getting the error and checking again? Also is there anything in the general tab? Also possibly do you have a server manager in MSSQL that shows running/attempted queries? Nov 20, 2017 at 11:19
  • Sorry, but there is no error-info in the "Log Messages Panel". The manager of the mssql-sever asked me, where QGIS wants to save the layer-style-table.
    – vezzon
    Nov 20, 2017 at 11:37

1 Answer 1


Based on the source code, it should just be:



With the full query as:

    bool execOk = query.exec( QString( "CREATE TABLE [dbo].[layer_styles]("
                                   "[id] int IDENTITY(1,1) PRIMARY KEY,"
                                   "[f_table_catalog] [varchar](1024) NULL,"
                                   "[f_table_schema] [varchar](1024) NULL,"
                                   "[f_table_name] [varchar](1024) NULL,"
                                   "[f_geometry_column] [varchar](1024) NULL,"
                                   "[styleName] [varchar](1024) NULL,"
                                   "[styleQML] [text] NULL,"
                                   "[styleSLD] [text] NULL,"
                                   "[useAsDefault] [int] NULL,"
                                   "[description] [text] NULL,"
                                   "[owner] [varchar](1024) NULL,"
                                   "[ui] [text] NULL,"
                                   "[update_time] [datetime] NULL"
                                   ") ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]" ) );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.