New answers tagged

0

If you want to only show the column if data is present then maybe create a function with two possibilities inside IF statements: IF data is present (Run the normal query) ELSE (copy the same query but without the empty column)


1

You just need to add a case statement to your select list: declare @bid varchar(4) = '1007' select sr.release_date, sr.customer_id, sr.customer_name, sr.item_id, sr.item_desc, sr.order_no, sr.qty_on_hand, sr.release_qty, sr.qty_after_released, sr.extended_sell, sr.enough, case when sr.route_code in ('pm 01','...


1

You may want to consider using the query that will show you free space in the log and free space in the data file. If you add them up you'll get the similar value as the SSMS is showing. This is an excellent query which does just that: DECLARE @log_used DECIMAL(19,7); CREATE TABLE #x(n SYSNAME, s DECIMAL(19,7), u DECIMAL(19,7), b BIT); INSERT #x EXEC('DBCC ...


0

While there isn't any option that I am aware of to turn off this feature, a simple ctrl+h and then replace both [ and ] with an empty space will quickly remove the brackets from the generated t-sql scripts.


0

I had the same problem with SSMS 2016. I used procmon to identify that the last thing it did before a several-second delay was make a network connection to a Microsoft IP address. I then tried turning off the Customer Experience Program by setting registry key HKEY_CURRENT_USER\SOFTWARE\Microsoft\Microsoft SQL Server\130 value CustomerFeedback from 1 to 0. ...


0

You are measuring CPU time, not real SQL Server query execution time or real CPU usage. Why do you expect these numbers to add up? You have to use SQL Profiler or Extended events to capture CPU usage by those queries.


4

You don't have to change the option every time. If you change the selection in Tools > Options > Object Explorer > Scripting, it should persist. As for why not scripting indexes is the default, I have no idea. Not a great question for your peers; if you really want the background, hit up someone on the SSMS team and buy them a beer - maybe they'll be able ...


0

Try Open query BEGIN TRANSACTION; select top 10 * INTO #t from openquery ("YOUR LINKED SERVER NAME",'SELECT * FROM [SOURCE TABLE NAME]); COMMIT


-3

I had the same error and all I did was run the SQL Server repair functionality and it got fixed right away. I didn't even have to restart.


3

You have several SQL Server errors in the posted message: String or binary data would be truncated. The INSERT statement conflicted with the FOREIGN KEY constraint "FK_UPC_Item". The conflict occurred in database "PosBe", table "dbo.Item", column 'Item_ID'. The INSERT statement conflicted with the FOREIGN KEY constraint "FK_VendorPartNo_Item". ...


1

The easiest and most manageable way to achieve this is using Active Directory groups. Have your ad administrator create a security group called SQL_Writers (or something similar) for those users and add them (and any new users to that group). Then in SQL Server, simply grant that security group the appropriate permissions to the server / databases. If you ...


-1

To do my process you need AD username and password. Keep'em handy. 1) Click on Start->All Programs->Microsoft SQL Server XXXX (Here XXXX is the Version of SQL Server you have). 2) Hold the Shift button and Right-Click on the application "SQL Server Management Studio". 3) Click on Run as different user. 4) Provide the AD username & password.


2

You can run SSMS as a different user via runas /netonly as described here. However for that method you would need to know the other user's password. You can also use EXECUTE AS to impersonate that user from inside a query window logged in as you (as long as you have the required permissions to do so). EXECUTE AS 'user_name'; /* Some SQL Statements */ ...


0

Uncheck the box in the follow setting: Check Tools -> Query Execution -> SQL Server -> Advanced -> "Disconnect After The Query Executes"


4

In SSMS 2016, Navigate To... is gone. So the answer is that temporary presence of non-functioning Navigate To... feature in SSMS 2014 looks like forgotten artifact of adopting SSMS to Visual Studio platform. Perhaps we should seek nothing more serious behind it. Comment: SSMS 2016 seems to be much more polished, it fixes many weird technical and design ...


0

Finally, subfolders were made possible in SSMS 2016. Cautious users: You can install SSMS 2016 and still keep using old one. See note [1] below. Once there, start using solutions instead of projects. Subfoldering works like this: Adding solution subfolder: Right-click solution item (tree root) and from menu select Add > New Solution Folder. Step 1 ...


2

Just for reference, this problem seems to be related to this bug: https://connect.microsoft.com/SQLServer/feedback/details/791630/cannot-view-properties-of-database-when-using-db-owner-account I have the same problem with SQL Server Management Studio 2012. If anyone finds stuck with this problem, try to update the SQL Server Management Studio. This way, ...


1

I had exactly this issue. everything was working fine until I noticed that the green indicator on the database cylinder logo (next to the instance name) became white instead of green (exactly as you have). Permissions were also fine. I restarted SSMS and connected again to the same instance and issue was solved.


5

SSMS always truncates long strings unless typed as XML in which case you can set it to allow unlimited. The workaround I usually use (from here) is below SELECT (SELECT YourTraceDataColumn AS [processing-instruction(x)] FOR XML PATH(''), TYPE) FROM YourTraceTable This adds a few leading (<?x) and trailing (?>) characters but otherwise leaves the ...


5

There are multiple entries because you can be granted the same permission multiple times, from different "grantors". If that principal (i.e. the "grantee") were already granted that same permission from two grantors, then you would see three entries for that same permission on this screen. For the "duplicate" entries that you are seeing, the one with the ...


1

You can use sys.databases joined with sys.server_principals SELECT sd.NAME AS databaseName ,sp.NAME AS database_owner FROM sys.databases sd INNER JOIN sys.server_principals sp ON sd.owner_sid = sp.SID WHERE sd.state_desc = 'OFFLINE' --> since you want for offline databases ! You can even use at your own risk --> sp_msloginmappings ( <-- ...


2

You could do something like this: SELECT RIGHT('00' + CONVERT(VARCHAR(2), datename(mi,GETDATE())), 2)


0

I just deleted the file from here: C:\Users\peter\AppData\Roaming\Microsoft\Microsoft SQL Server\110\Tools\Shell and then restarted Studio.



Top 50 recent answers are included