ssms

Bypassing character limit on OPENQUERY failing use EXECUTE

旧巷老猫 提交于 2019-12-07 14:48:07
问题 I am currently using SQL Server Management Studio 17 to connect to an Oracle database instance and then extract some data and insert it into a SQL Server Table I have. I have tried doing the following: DROP TABLE IF EXISTS [jerry].[dbo].[purchases] SELECT * INTO [jerry].[dbo].[purchases] FROM OPENQUERY(OLAP, ' proprietary sql code '); However the SQL code is about 9500 characters and thus OPENQUERY fails, which is supported by MSDN articles I referenced these sites: - MSDN One - MSDN Two and

SSMS SMO Objects: Get query results

落花浮王杯 提交于 2019-12-07 11:37:53
问题 I came across this tutorial to understand how to execute SQL scripts with GO statements. Now I want to know what can I get the output of the messages TAB. With several GO statements, the output would be like this: 1 rows affected 912 rows affected ... But server.ConnectionContext.ExecuteNonQuery() can return only an int, while I need all the text. In case there is some error in some part of query, it should put that also in the output. Any help would be appreciated. 回答1: The easiest thing is

Limit Database List to Ones With Permission SQL Server

帅比萌擦擦* 提交于 2019-12-07 10:28:01
问题 By default if you connect to a remote SQL Server via an account that has access to say 1 of the 10 databases. You will still see in the Object Explorer all other databases, obviously due to permissions you cannot actually query them, but you can see their names. I have heard that there is a method that disable this behavior, but I've been unable to find the answer, does anyone know how to do this? To give an example I have a SQL Server called MyDbServer, it has 4 databases, MyDatabase

SSAS DB not visible in Management Studio but can be seen in Excel

人走茶凉 提交于 2019-12-07 07:53:10
问题 There is a SQL 2012 Analysis Server with some cubes. When I connect to it using Excel 2013 (DATA menu > From Other Sources > From Analysis Services), I can see the DB names in the dropdown. But when I connect to it with SQL Server Management Studio 2012 (with Analysis Service Client installed, I've used it against other Analysis Servers successfully), I can connect to the Analysis Server, but cannot see any DB - the Databases folder is empty. Did I miss anything? Is it possible that it's

Can't add System.IO.Compression to trusted assemblies in SQL Server

早过忘川 提交于 2019-12-07 07:03:12
问题 I am trying to create a SQLCLR stored procedure in NET 4.5 that fiddles with ZIP files. Obviously System.IO.Compression is not on SQL Server's approved list but this is what I get when I try to add it manually via SQL Server Management Studio. The same happens if I try to execute CREATE ASSEMBLY via a query. Any ideas? Why is this a no-no? I have also tried running this command in SSMS: CREATE ASSEMBLY SystemIOCOMPRESSION FROM 'C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\

How to get “admin rights” in SQL Server Management Studio?

ぐ巨炮叔叔 提交于 2019-12-07 05:50:44
问题 I'm using SQL Management Studio 2008 Express as a graphic interface to my local SQL Server 2008 Express instance, both of which I have locally only as a test and developement interface for my web projects. I have recently grown more confident in SQL coding, and started to use some more complicated sql stuff - my latest field of exploration being triggers. However, to my great surprise I don't seem to have admin rights on my server instance, which means I can't do simple things like debugging

Generate changes script

有些话、适合烂在心里 提交于 2019-12-07 05:40:48
问题 Let's imagine I added new column for some table in SQL Server Management Studio. Is there any way to get change script which is executed when I press save? What I want to achieve is to apply the same change to other databases (we have a separate database for each developer for debuggin purposes). 回答1: I assume you are using table designer in MS SSMS. Do the changes in the designer and just before hitting Save , go to the Table Designer menu and select Generate Change Script... . 来源: https:/

SQL Command Add Database Diagramming

泄露秘密 提交于 2019-12-07 05:17:32
问题 Is there a tsql command on sqlserver 2008 which can be run in order to enable Database Diagramming instead of this dialog appearing: This database does not have one or more of the support objects required to use database diagramming. Do you wish to create them? 回答1: The script is a little too long to add here, but here's what you can do. 1) Create a new database. 2) Start sql server profiler 3) Click the "Database Diagrams" folder in management studio. 4) Clear the profiler. 5) Confirm the

How to set default value while insert null value into not null column SQL Server?

时光怂恿深爱的人放手 提交于 2019-12-07 04:47:12
问题 I have two tables t1 and t2 . Both have id and name columns. The name column of t1 is defined as not null and it has the default value of 'Peter'. I want to insert all the values from t2 into my t1 table. But I have some null values in t2 table. When I try to insert the values: Insert into t1 select * from t2; It throws this error: Msg 515, Level 16, State 2, Line 1 Cannot insert the value NULL into column 'Name', table 'T1'; column does not allow nulls. Is there any possibilities to set the

Group tables by schema in SSMS

爷,独闯天下 提交于 2019-12-07 01:58:59
问题 In Visual Studio's Server Explorer window there's a very nice feature that lets you see the DB objects grouped by schema: It turns this object tree: Data Connections -> MyServer -> Tables -> MyTable ( MySchema ) Into this one: Data Connections -> MyServer -> Schemas -> MySchema -> MyTable I've been looking for this particular feature in SSMS but was unable to find it. Does it exist? If not, is there a plugin which would provide this feature? Or perhaps is there a plugin which would help ease