Rebuild index menu not available in SSMS for Azure SQL database - azure-sql-database

Connected to Azure SQL Database from SSMS. The versions are (1) Microsoft SQL Azure (RTM) - 12.0.2000.8 (2) SSMS 18.11.1
Rebuild index menu option not available when right click index folder level or individual index level. The snapshots are attached. What is missing ?
(1) Folder level
(2) Index level

I created SQL database in Azure portal.
Image for reference:
I login in MSSM using Azure SQL server credentials.
Image for reference:
I connected to Azure SQL database in MSSM successfully.
Image for reference:
I also didn't get option of rebuild index
Image for reference:
I used below query to check the list of the indexes in the database, with the most fragmented first.
SELECT
OBJECT_SCHEMA_NAME(ips.OBJECT_ID) 'Schema',
OBJECT_NAME(ips.OBJECT_ID) 'Table',
i.NAME,
ips.index_id,
index_type_desc,
avg_fragmentation_in_percent,
avg_page_space_used_in_percent,
page_count
FROM
sys.dm_db_index_physical_stats(DB_ID(), NULL, NULL, NULL, 'SAMPLED') ips
INNER JOIN
sys.indexes i
ON (ips.object_id = i.object_id)
AND
(
ips.index_id = i.index_id
)
ORDER BY
avg_fragmentation_in_percent DESC
I got the output as below:
I rebuild index of TestTable using below code:
ALTER INDEX <indexName> ON <TableName> REBUILD WITH (ONLINE = ON)
Output:
It worked successfully in my machine please check from your end.

Related

How to identify server admin account name in windows Azure SQL Database

There are two administrative accounts (Server admin and Active Directory admin) that act as administrators. My requirement is to find out the names of these accounts. I have looked into sys.database_principles view and sys.sql_logins view but could not find anything relevant to the same. From SQL query i could not find any helpful system view to fetch the information. Can anyone please help me here?
You can use the TSQL script below to get the Server Admin and Active Directory Admin account names.
SELECT [name], [type], [type_desc], [authentication_type], [authentication_type_desc] FROM sys.database_principals
WHERE (type = 'S' AND [name] != 'dbo' AND authentication_type = 1) OR
(type = 'X' AND authentication_type = 4)
Important Note:
You need to run the TSQL against the master system database
Use the latest version of SQL Server Management Studio
Alternatively, you can get both account names from the Azure portal as shown below.
Reference: Controlling and granting database access

Creating index in SQL Server with ONLINE = ON if supported

I'm creating an index in a SQL Server table with ONLINE = ON option:
CREATE INDEX IX_Name ON Users (Name) WITH ONLINE = ON
If this script is run on non-Enterprise SQL Server edition I get this error:
Online index operations can only be performed in Enterprise edition of SQL Server.
How to write a SQL script to use ONLINE = ON option on Enterprise editions and not to use it for non-supported editions?
Something like this should help
IF SERVERPROPERTY ('edition') like '%Enterprise%Edition%'
BEGIN
CREATE INDEX IX_Name ON Users (Name) WITH ONLINE = ON
END
Also I think the login you are using should have permission to View Server State

Can't create an index catalog in localdb v\11.0

SQL statement:
CREATE TABLE [dbo].[indexTable] (
[mapId] VARCHAR (50) NOT NULL,
[keyword] VARCHAR (900) NULL,
PRIMARY KEY CLUSTERED ([mapId] ASC)
);
Go
CREATE FULLTEXT CATALOG FTSearch
This is the error I get
Creating [FTSearch]...
SQL72014: .Net SqlClient Data Provider:
Msg 9982, Level 16, State 100, Line 1
Cannot use full-text search in user instance.
I am using localdb\v11.0 that is installed along with visual studio 2012.
localdb\v11.0 does not support fulltext index. I installed MS SQL Server 2012 express with Advanced Services and it worked like a charm. I had to create an entirely new database again though it wasn't really much of a problem for me as i just copy pasted all the DDL statements from the my previous database. Also i had to use '.\SQLEXPRESS' instead of '(LocalDb)\v11.0' as the server name.
During installation if you want to save disk space then only install Full-Text and Semantic Extractions for Search and leave all the other features unchecked.
EDIT:
You can use your old databse. Copy the old database files to a new location preferably to something like C:\Program Files\Microsoft SQL Server\MSSQL11.SQLEXPRESS\MSSQL\DATA
and run the following sql statement.
CREATE DATABASE databaseName
ON (FILENAME = 'C:\Program Files\Microsoft SQL
Server\MSSQL11.SQLEXPRESS\MSSQL\DATA\filename.mdf'), -- Main Data File .mdf
(FILENAME = 'C:\Program Files\Microsoft SQL
Server\MSSQL11.SQLEXPRESS\MSSQL\DATA\filename_log.ldf') -- Log file .ldf
FOR ATTACH
GO

How can I query the list of database roles in a SQL Server 2000 database?

In Sql Server 2000, is it possible to return, via SQL query, a complete list of database roles that exist in a given database?
I know it is possible to see these roles by expanding the Security, Roles, and Database Roles nodes in SQL Server Management Studio, but I'd like to get them through a query that I can parse programmatically.
To clarify, I'm not looking for a list of users with their roles, but just the list of roles themselves.
Every database in SQL Server 2000 has a sysusers system table
Probably something like
Use <MyDatabase>
Select
[name]
From
sysusers
Where
issqlrole = 1
will do the trick
With our SQL Server 2016 this works for me
Use Sandbox
Select
name, principal_id
From
sys.database_principals
Where
type = 'R' and principal_id < 16384
where Sandbox is the name of my database.
(I'm using SQL with ESRI ArcGIS Enterprise 10.6.)

FTS in sql 2005

Can somebody please explain how to find out if full text search is enabled in SQL 2005.
FTS Installed At the Instance Level
SELECT SERVERPROPERTY('IsFullTextInstalled')
This will return 0 or 1 if full text search is installed (Instance wide).
FTS Enabled At the Database Level
SELECT is_fulltext_enabled FROM sys.databases
WHERE database_id = DB_ID()
This will return 0 or 1 if full text search is enabled in the current database.
See if the SQL Server FullText Indexing service is running.
After that, you have to create a catalog for the database and then the fulltext indexes on the relevant columns.
For more information, refer to the documentation: http://msdn.microsoft.com/en-us/library/ms142497(SQL.90).aspx