ssms

Cannot install adventureworks 2012 database - Operating system error 5: Access is denied

不羁岁月 提交于 2019-11-26 19:36:23
问题 I am trying to install AdventureWorks 2012 database in sql server 2012. I got the mdf file from this link - http://msftdbprodsamples.codeplex.com/releases/view/93587 Here is the name of the file I downloaded - AdventureWorks2012_Database.zip I am doing all this on a windows 7 64 bit. I get the error below: Attach database failed for Server 'SuperPC\SQL2012'. (Microsoft.SqlServer.Smo) For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=11.0.2100.60+((SQL11_RTM

Add unique constraint in SQL Server 2008 GUI?

坚强是说给别人听的谎言 提交于 2019-11-26 19:22:39
问题 I have an existing table with data. I have just added a new column but I cannot find how to add a unique constraint on that column. Could someone please advise? Right-clicking and selecting "check constraints" wasn't helpful. 回答1: You need to right-click in the table designer and pick Indexes/Keys : Then a dialog pops up and you can add a new index to the list of indices (on the left hand side) and define it to be a unique index: 回答2: Do right-click in the table designer and choose Indexes

How to connect to LocalDb

…衆ロ難τιáo~ 提交于 2019-11-26 19:11:57
问题 I installed LocalDb using the SqlLocalDb.msi package and I can connect to it using SSMS using the server name (LocalDb)\v11.0 . So far so good. The problem is that when I try to connect to it via a .NET 4.5 application I get the error The server was not found or was not accessible. I started with the connection string Data Source=(LocalDb)\v11.0 and then added many things to no avail (integrated security true/sspi, attaching a db, using instances, etc.) 回答1: I think you hit the same issue as

Converting Select results into Insert script - SQL Server [closed]

烂漫一生 提交于 2019-11-26 18:56:08
问题 I have SQL Server 2008 , SQL Server Management Studio. I need to select data from Table1 in database1. Then I have to edit some values in the results and insert values into Table1 in database2. Or let me put it other way. How can I convert the data in one table into insert script . 回答1: SSMS Toolpack (which is FREE as in beer) has a variety of great features - including generating INSERT statements from tables. Update: for SQL Server Management Studio 2012 (and newer), SSMS Toolpack is no

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

我们两清 提交于 2019-11-26 18:54:41
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 from the text results. Is there any simpler workaround to preserve the CRLF in a copy/paste operation from the

Script all data from SQL Server database

ε祈祈猫儿з 提交于 2019-11-26 18:15:31
问题 I have two databases with equivalent structure and I need to extract data from one of them in form of INSERT statements (generate script to apply it on the other database). How can I do it using Management Studio? 回答1: You could use the free SSMS Toolpack add-in for SQL Server Management Studio. See the section on Generate Insert statements from resultsets, tables or database Update: OK, for SSMS Toolpack in SSMS 2012, a licensing scheme has been introduced. SSMS Toolpack for earlier versions

How do you view ALL text from an ntext or nvarchar(max) in SSMS?

£可爱£侵袭症+ 提交于 2019-11-26 18:13:23
How do you view ALL text from an NTEXT or NVARCHAR(max) in SQL Server Management Studio? By default, it only seems to return the first few hundred characters (255?) but sometimes I just want a quick way of viewing the whole field, without having to write a program to do it. Even SSMS 2012 still has this problem :( Remus Rusanu Options (Query Results/SQL Server/Results to Grid Page) To change the options for the current queries, click Query Options on the Query menu, or right-click in the SQL Server Query window and select Query Options. ... Maximum Characters Retrieved Enter a number from 1

How to quickly edit values in table in SQL Server Management Studio?

一曲冷凌霜 提交于 2019-11-26 18:01:50
问题 Aside from context menu -> "Edit Top 200 Rows" from Object Explorer, is there a quick way to open a table in Edit mode where I can just quickly modify the value of a cell? I need to be able to page past the first 200 rows. And I dont want to write "insert" script for every minor tweak I need to do... I don't understand why SMS doesn't offer quick access to a paged table editor (like Navicat). 回答1: In Mgmt Studio, when you are editing the top 200, you can view the SQL pane - either by right

How can I change my default database in SQL Server without using MS SQL Server Management Studio?

家住魔仙堡 提交于 2019-11-26 17:34:21
问题 I dropped a database from SQL Server, however it turns out that my login was set to use the dropped database as its default. I can connect to SQL Server Management Studio by using the 'options' button in the connection dialog and selecting 'master' as the database to connect to. However, whenever I try to do anything in object explorer, it tries to connect using my default database and fails. Does anyone know how to set my default database without using object explorer ? 回答1: Alternative to

Incorrect syntax near ''

家住魔仙堡 提交于 2019-11-26 17:09:29
问题 I'm trying to run the following fairly simple query in SQL Server Management Studio: SELECT TOP 1000 * FROM master.sys.procedures as procs left join master.sys.parameters as params on procs.object_id = params.object_id This seems totally correct, but I keep getting the following error: Msg 102, Level 15, State 1, Line 6 Incorrect syntax near ''. It works if I take out the join and only do a simple select: SELECT TOP 1000 * FROM master.sys.procedures as procs But I need the join to work. I don