Tag Info

Hot answers tagged

8

You could create a domain group that you could use to create as login and user on your SQL Server and YourDatabase. After creating the domain group, you could do something like: USE [master] GO CREATE LOGIN [DOMAIN\AllUsersForYourDatabase] FROM WINDOWS GO USE [YourDatabase] GO CREATE USER [DOMAIN\AllUsersForYourDatabase] FOR LOGIN ...


7

Try running a trace with SQL Profiler while you, and then your coworker, connect to the server. Select RPC, SQL Statement & PreConnect - Starting/Completed. Select Save Results To Table option, then compare the 2 tables to find the bottleneck. Or, since you're connecting by IP, it could be doing a Reverse DNS lookup. If so, add a entry in your hosts ...


4

The query will be executed by sp_send_dbmail asynchronously, on a separate session that has msdb as current database. So you must use three-part names in your query: @query = N'select substring(PostOfficeBox,1,4) as [Postcode] ... from TestCRM.dbo.AccountExtensionBase as a JOIN TestCRM.dbo.CustomerAddressBase as b ON a.AccountId = b.ParentId ...'


3

What you should check first is your server or client DNS settings It's not the rare that your SQL Server have the problem connecting to Active Directory. If you try with local Windows account I am sure that you will not have the at issue. It's not unusual that server is configured with public internet DNS and when SQL Server connects to DC to check the ...


2

This should give you a start. It assumes that you've already cloned all the relevant objects and that all of your permissions are at the object or schema level (if you have column-level permissions, the script gets a little more complex, but not too bad). DECLARE @oldschema SYSNAME = N'schema1', @newschema SYSNAME = N'schema1_dev'; DECLARE @sql ...


2

Use SSMS 2014 SP1. That works. Currently.


1

You can simply use this : SELECT sc.name +'.'+ ta.name TableName ,SUM(pa.rows) RowCnt FROM sys.tables ta INNER JOIN sys.partitions pa ON pa.OBJECT_ID = ta.OBJECT_ID INNER JOIN sys.schemas sc ON ta.schema_id = sc.schema_id WHERE ta.is_ms_shipped = 0 AND pa.index_id IN (1,0) GROUP BY sc.name,ta.name ORDER BY SUM(pa.rows) DESC Various other methods ...


1

Drop the WHERE object_name(object_id) = 'xxx' and instead GROUP BY your object name. Also, join back to sys.objects to get those objects of type 'U'. SELECT OBJECT_NAME(st.object_id), Total_Rows = SUM(st.row_count) FROM sys.dm_db_partition_stats st INNER JOIN sys.objects AS o ON o.object_id = st.object_id WHERE (index_id < 2) AND o.type = 'U' ...


1

Well, I'm a little ashamed... SQL Server 2014 SP1 was not installed on my client machine. Doing so seems to fix the problem with SSMS Intellisense.



Only top voted, non community-wiki answers of a minimum length are eligible