ssms

How to generate scripts to recreate table using SQL Server Management Studio [Schema and data]?

ぐ巨炮叔叔 提交于 2019-11-28 17:44:39
I have a table in a local SQL server database. I want to recreate this table in a hosted database. What I want to do is to have a script that when run against the hosted database, this table is recreated with all the data, etc. How do I create this script using SQL Server Management Studio? Thanks. 1- Open SQL server Management Studio. 2- Right click on the DB that contains your desired table. 3- Select "Tasks => Generate Scripts...". 4- Follow on the wizard, and choose the objects that you want to generate scripts for (Tables, Views, Stored Procedures, etc... ). 5- From the next step, click

How to edit data in result grid in SQL Server Management Studio

旧城冷巷雨未停 提交于 2019-11-28 17:18:37
问题 I want to edit some row values once I get a query output in the result grid. Its true that we can right click the table and say open table to get an editable table output, but what I want is editable query output, only certain rows matching for my criteria, and edit them in the result grid. Can this possible inside Microsoft SQL server Management Studio Express? 回答1: You can do something similar to what you want. Right click on a table and select "edit top 200 rows" (if you are on SQL Server

How can I check if an SQL result contains a newline character?

一个人想着一个人 提交于 2019-11-28 17:13:12
I have a varchar column that contains the string lol\ncats , however, in SQL Management Studio it shows up as lol cats . How can I check if the \n is there or not? SELECT * FROM your_table WHERE your_column LIKE '%' + CHAR(10) + '%' Or... SELECT * FROM your_table WHERE CHARINDEX(CHAR(10), your_column) > 0 Sachin Shanbhag Use char(13) for '\r' and char(10) for '\n' SELECT * FROM your_table WHERE your_column LIKE '%' + CHAR(10) + '%' or SELECT * FROM your_table WHERE your_column LIKE '%' + CHAR(13) + CHAR(10) + '%' For any fellow MySQL users who end up here: SELECT * FROM your_table WHERE your

How can I display the execution plan for a stored procedure?

此生再无相见时 提交于 2019-11-28 16:50:37
I am able to view the Estimated Execution Plan (Management Studio 9.0) for a query without a problem but when it comes to stored procedures I do not see an easy way to do this without copying the code from the ALTER screen and pasting it into a query window, otherwise it will show the plan for the ALTER and not the procedure. Even after doing this, any inputs are missing and I would need to DECLARE them as such. Is there an easier way to do this on stored procedures? Edit: I just thought of something that might work but I am not sure. Could I do the estimated execution plan on exec

How get the T-SQL code to find duplicates?

故事扮演 提交于 2019-11-28 15:58:42
问题 MS Access has a button to generate sql code for finding duplicated rows. I don't know if SQL Server 2005/2008 Managment Studio has this. If it has, please point where If it has not, please tell me how can I have a T-SQL helper for creating code like this. 回答1: Well, if you have entire rows as duplicates in your table, you've at least not got a primary key set up for that table, otherwise at least the primary key value would be different. However, here's how to build a SQL to get duplicates

Does the Poor Mans T-SQL formatting add-in for Management Studio 2012 work in Management Studio 2014?

穿精又带淫゛_ 提交于 2019-11-28 15:35:35
问题 Does the Poor Mans T-SQL formatting add-in for Management Studio 2012 work in Management Studio 2014? In SSMS 2012, if I go to tools, it showed up in the list. In SSMS 2014, it doesn't. I tried to run the installer again, and it gave me options to repair or uninstall. I had the formatter installed prior to installing 2014. EDIT: The tool is available here. 回答1: Create the folder %SystemDrive%\ProgramData\Microsoft\SQL Server Management Studio\12.0\Addins\ if it does not exist. Then just copy

How to install SQL Server Management Studio 2012 (SSMS) Express?

余生长醉 提交于 2019-11-28 15:26:52
问题 I just installed SQL Server 2012 Express , I can connect with database from VS2012RC . Database is working :) I use Win7 SP1 64bit . I download program from page I choose ENU\x64\SQLManagementStudio_x64_ENU.exe I want to install Management Studio 2012 , but after unpack installer has stopped. I see only for moment some console application. What could be cause? Where can I find any log file? 回答1: You need to install ENU\x64\SQLEXPRWT_x64_ENU.exe which is Express with Tools (RTM release. SP1

Where is SQL Server Management Studio 2012?

此生再无相见时 提交于 2019-11-28 15:18:36
I had SQL Server 2008 R2 and Visual Studio 2008 and 2010 on my laptop. I've installed SQL Server 2012 and have finally got SQL Server Data Tools to show up, so that I can create SSRS reports in Visual Studio 2010. Although I've installed Management tools - many times - on two separate instances of SQL Server 2012, I can't find them in Programs and can't run them. The only SSMS program I can find runs SSMS 2008 R2. I realise that common advice is to install SQL Server before Visual Studio, but I really don't want to uninstall Visual Studio, as this will bring a host of other problems. How can I

ALTER DATABASE failed because a lock could not be placed on database

孤人 提交于 2019-11-28 15:07:23
I need to restart a database because some processes are not working. My plan is to take it offline and back online again. I am trying to do this in Sql Server Management Studio 2008: use master; go alter database qcvalues set single_user with rollback immediate; alter database qcvalues set multi_user; go I am getting these errors: Msg 5061, Level 16, State 1, Line 1 ALTER DATABASE failed because a lock could not be placed on database 'qcvalues'. Try again later. Msg 5069, Level 16, State 1, Line 1 ALTER DATABASE statement failed. Msg 5061, Level 16, State 1, Line 4 ALTER DATABASE failed

SQL Server. How to refresh the intellisense? [duplicate]

蓝咒 提交于 2019-11-28 14:50:06
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Lost the IntelliSense SQL Server 2008 Intellisense problem I'm new to SQL Server, so this is probably an easy fix. In SQL Server 2008 R2, I've just imported a new data table and/or renamed fields in an existing table (it happens either way). When I start to write some SQL, the intellisense doesn't recognize the new field names and starts underlining everything. The only fix I've found is to close and reopen SQL