Tag Info

New answers tagged

2

You can use a CHECK constraint with a CASE expression. If check2 is enabled, make sure check1 is enabled too, otherwise you can default to a no-op ("checking" that check1 = check1). For simplicity I'm assuming these columns are not NULLable. CREATE TABLE dbo.foo ( check1 BIT NOT NULL DEFAULT 0, check2 BIT NOT NULL DEFAULT 0, CONSTRAINT ck_both CHECK ...


0

I thought I'd create a table for quick reference. CREATE TABLE dbo.TraceDefinition ( TraceFlag INT NOT NULL CONSTRAINT PK_TradeDefinition PRIMARY KEY CLUSTERED, [Description] VARCHAR(MAX) NOT NULL ) INSERT INTO dbo.TraceDefinition (TraceFlag, [Description]) SELECT TraceFlag, [Description] FROM (VALUES (260, 'Prints versioning information about extended ...


7

It's signifying a unique constraint. In SQL Server, a unique constraint is actually implemented as an index under the covers; this is why it appears under the Indexes node as well (I can't give you a good explanation of why it is not at least listed under the Constraints node, nor why they chose an upside down key instead of just a different color). You ...


0

You can use this script to extract your databases as .dacpac files, which can be used in Visual Studio to translate to a full database schema. #extract all your database schemas as dacpacs $server = 'PICARD' $dbs = Invoke-Sqlcmd -ServerInstance $server -Database tempdb -Query 'SELECT name FROM sys.databases WHERE database_id >4' foreach($db in ...


4

CREATE DATABASE [your_database_name_here] ON ( FILENAME = N'C:\sql server\nologfile.mdf' ) FOR ATTACH_REBUILD_LOG; GO -- Use this 'ATTACH_REBUILD_LOG' when you have one or more log files. 'FOR ATTACH' works with one and only one log file A POSSIBLE TEST DEMO... USE [master]; GO IF DATABASEPROPERTYEX(N'TlogDemo' , N'Version') > 0 BEGIN ...


0

Can you please confirm the Compatibility level of the database you upgraded? (Right-click the database -> Properties -> Options -> Compatibility level). If this is set to 2005, please don't change it without thoroughly testing your applications, etc. as it could definitely break your environment! Just curious as to the value here. Also, I did some work with ...


0

I found the solution that I wanted: -- how to disable a linked server --check the existent linked servers SELECT * FROM SYS.SERVERS WHERE NAME = 'SWLON1' -- Disable data access EXEC sp_serveroption @server = 'SWLON1' ,@optname = 'data access' ,@optvalue = 'FALSE' -- ABOUT procedure sp_serveroption ...


0

Unless you control login privelages , you will not able to restrict them.so think like you have granted them only basic select to see the table data.since you are not maintaining server ,, they can easily get admin privelages.maintenance stuff still should be taken by client and once bavkups are taken they can see schema , sp..one way I can think of is ...


-1

Every database user belongs to the public database role. When a user has not been granted or denied specific permissions on a securable object, the user inherits the permissions granted to public on that object. Therefore unless until you can grant any permission to users for their login they wont be able to access tables, however can only see the databases ...


1

I had thought you would be able to use policy based management but couldn't find a way to get the PasswordLastSetTime property. It didn't exist in the Login facet. However what you an do is run the following query to get the PasswordLastSetTime for all SQL Logins on the instance, then use a tool such as Idera's Multi Query or a CMS (Central Management ...



Top 50 recent answers are included