ssms

Import / Export database with SQL Server Server Management Studio

旧城冷巷雨未停 提交于 2019-11-26 11:50:43
问题 I thought this would be trivial, but it isn\'t... I\'m sure there is a simple way to do it but I can\'t manage to find it. Shame on me. I want to import/export the database itself, the tables, the constraints (foreign keys and so on). I\'d rather not get the data with it, but I can get rid of it after if there\'s no other way. So... how do you export a database using MS SQL Server Management Studio ? How do you import it? The only solution I found was right click on the tables and \"script to

Removing the remembered login and password list in SQL Server Management Studio

做~自己de王妃 提交于 2019-11-26 11:47:30
问题 I\'ve recently used our company\'s spare laptop (that has a general user set up) while mine was being repaired. I\'ve checked the \"Remember password\" option in SQL Server Management Studio when logging in to the database. I need to clear the login and password information that I have used to prevent the next person that will use the laptop from using my login names and passwords. How can I do this? 回答1: Another answer here also mentions since 2012 you can remove Remove cached login via How

Export stored procedure result set to Excel in SSMS

為{幸葍}努か 提交于 2019-11-26 11:38:07
问题 i\'m using SSMS and attempting to export the results of a stored procedure to a new excel file. The SP accepts an int parameter but I cannot find a way to call it in the query. Latest effort- EXEC sp_makewebtask @outputfile = \'C:\\Users\\me\\Documents\\testing.xls\', @query = **ExportAsExcel** N\'@id\' = 123 @colheaders =1, @FixedFont=0,@lastupdated=0,@resultstitle=\'Testing details\' Running the stored procedure results in two tables of data, which I need on separate sheets. Can any of you

SSMS version 18 – no Database Diagrams

只愿长相守 提交于 2019-11-26 11:00:10
问题 I notice that Database Diagrams are not supported in SSMS version 18, any idea why, and is there a way to get the same functionality? And why is the T-SQL debugger gone now? 回答1: As it was posted at June 11, 2019, to announce that SQL Server Management Studio (SSMS) 18.1 is now generally available , the Database diagrams is back in SSMS 18.1 along side SSBDIAGNOSE.EXE and Integration Services (SSIS) Original Answer: The feature is deprecated, you can visit SQL Server Management Studio -

How to see query history in SQL Server Management Studio

倖福魔咒の 提交于 2019-11-26 10:08:35
Is the query history stored in some log files? If yes, can you tell me how to find their location? If not, can you give me any advice on how to see it? Aaron Bertrand [Since this question will likely be closed as a duplicate.] If SQL Server hasn't been restarted (and the plan hasn't been evicted, etc.), you may be able to find the query in the plan cache. SELECT t.[text] FROM sys.dm_exec_cached_plans AS p CROSS APPLY sys.dm_exec_sql_text(p.plan_handle) AS t WHERE t.[text] LIKE N'%something unique about your query%'; If you lost the file because Management Studio crashed, you might be able to

How to see the values of a table variable at debug time in T-SQL?

大城市里の小女人 提交于 2019-11-26 10:07:14
问题 Can we see the values (rows and cells) in a table valued variable in SQL Server Management Studio (SSMS) during debug time? If yes, how? 回答1: That's not yet implemented according this Microsoft Connect link: Microsoft Connect 回答2: DECLARE @v XML = (SELECT * FROM <tablename> FOR XML AUTO) Insert the above statement at the point where you want to view the table's contents. The table's contents will be rendered as XML in the locals window, or you can add @v to the watches window. 回答3: This

SSMS Results to Grid - CRLF not preserved in copy/paste - any better techniques?

会有一股神秘感。 提交于 2019-11-26 08:56:57
问题 When I have a result set in the grid like: SELECT \'line 1 line 2 line 3\' or SELECT \'line 1\' + CHAR(13) + CHAR(10) + \'line 2\' + CHAR(13) + CHAR(10) + \'line 3\' With embedded CRLF, the display in the grid appears to replace them with spaces (I guess so that they will display all the data). The problem is that if I am code-generating a script, I cannot simply cut and paste this. I have to convert the code to open a cursor and print the relevant columns so that I can copy and paste them

How to find server name of SQL Server Management Studio

徘徊边缘 提交于 2019-11-26 08:43:51
问题 I installed Microsoft SQL Server 2008. When I start SQL Server Management Studio (SSMS), I get the Connect to Server login window with a blank textbox for Server name . I have tried a lot of names, but I couldn\'t solve it. How can I find / get the server name? 回答1: Open up SQL Server Configuration Manager (search for it in the Start menu). Click on SQL Server Services . The instance name of SQL Server is in parenthesis inline with SQL Server service. If it says MSSQLSERVER , then it's the

SQL Formatter for SQL Management Studio [closed]

半城伤御伤魂 提交于 2019-11-26 08:40:54
问题 I was wondering if there is a plugin/tool for SQL Server Management Studio that will format your SQL? I\'m working with some large-ish stored procs that are a mangled mess of poorly formatted SQL and it\'d be nice if I could just go \"Select All -> Format SQL\" 回答1: Today I discovered Apex SQL Refactor. It is a free plugin. Integrates with SSMS. Downside is that it is an all or nothing process. It does not refactor as you type. 回答2: Late answer, but hopefully worthwhile: The Poor Man's T-SQL

how do I make a composite key with SQL Server Management Studio?

别等时光非礼了梦想. 提交于 2019-11-26 08:06:52
问题 how do I make a composite key with SQL Server Management Studio? I want two INT columns to form the identity (unique) for a table 回答1: Open the design table tab Highlight your two INT fields (Ctrl/Shift+click on the grey blocks in the very first column) Right click -> Set primary key 回答2: here is some code to do it: -- Sample Table create table myTable ( Column1 int not null, Column2 int not null ) GO -- Add Constraint ALTER TABLE myTable ADD CONSTRAINT pk_myConstraint PRIMARY KEY (Column1