ssms

Stop SSMS from scripting SPs using sp_executesql?

旧时模样 提交于 2019-12-04 00:25:47
When I use SSMS to script a stored procedure, it wraps the script in a sp_executesql statement which bugs me. Is there a way to stop SSMS from doing this and use a straight CREATE PROCEDURE...? EDIT : I meant SSMS not SSIS Turn off the "Include IF NOT EXISTS" option. It's at Tools..Options, then click "Scripting" on the explorer pane of the dialog that pops-up. the "IF NOT EXISTS" option is in the second group from the top (Object Scripting options). Execute SQL Task Editor (General Page) Look at the "QueryIsStoredProcedure" and "BypassPrepare" options 来源: https://stackoverflow.com/questions

Forcing Management Studio to use ALTER TABLE instead of DROP/CREATE

谁说我不能喝 提交于 2019-12-04 00:25:38
问题 I'm wondering if is there a way to force MSSQL Management Studio to produce a script like this: ALTER TABLE Mytable ADD MyCol bit NOT NULL CONSTRAINT MyColDefault DEFAULT 0 WITH VALUES ALTER TABLE [dbo].Mytable ALTER COLUMN MyCol2 int NULL GO when I alter a very simple property of a column on a table. If I do this in the designer and ask for the produced script, the script doesn't do such simple tasks, but instead copies all the data in a tmp table, drops the original table, renames the tmp

IntelliSense is not working in SQL Server Management Studio

狂风中的少年 提交于 2019-12-04 00:19:55
We use SQL Server Management Studio 2008 R2. IntelliSense works with SA account perfectly. But it is not working with Windows Authentication user. The user has access master db with db_owner role but it's not sysadmin. How do I fix this issue? You can try solution from these questions1 or questions2 and questions3 . Or please try these steps as below: Enable IntelliSense: For all query windows, please go to Tools >> Options >> Text Editor >> Transact-SQL >> IntelliSense, and select Enable IntelliSense. For each opening query window, please go to Query >> Intellisense Enabled. Enable statement

Copying a large field (varbinary(max)) to file / clipboard

戏子无情 提交于 2019-12-04 00:04:07
I have a VARBINARY(MAX) field in a database table which contains ~35k characters. This field is a converted word document which unfortunately no longer have access to. This field is present in my dev database and I'm looking to port this value to a live database. However, if I purely select the contents out of the grid results in SQL I seem only to get ~28k of the available characters. So my question is this, what's the best way to migrate a field which has contents too large to simple copy and paste into and insert script? Any thoughts greatly appreciated. EDIT: As additional info, outputting

“collapse all' or ”toggle outline\" in SQL Server Management Studio 2008

人走茶凉 提交于 2019-12-03 23:53:45
A new feature in SQL Server Management Studio 2008 is 'outlining' (the ability to collapse regions). It is awesome. However, by default all regions are expanded. I can't seem to find a way to 'collapse all' (also called 'toggle outline' in Visual Studio). Is anyone aware of a way to do this? I've been tasked with reviewing a 3,000 line stored procedure, and collapsing regions one-by-one is cumbersome. It appears this feature does not exist. It has been recommended to Microsoft. I suggest voting it up; http://connect.microsoft.com/SQLServer/feedback/ViewFeedback.aspx?FeedbackID=368542 As a work

T-SQL Insert into table without having to specify every column

对着背影说爱祢 提交于 2019-12-03 23:53:05
In our db there is a table that has a little over 80 columns. It has a primary key and Identity insert is turned on. I'm looking for a way to insert into this table every column EXCEPT the primary key column from an identical table in a different DB. Is this possible? You can do this quite easily actually: -- Select everything into temp table Select * Into #tmpBigTable From [YourBigTable] -- Drop the Primary Key Column from the temp table Alter Table #tmpBigTable Drop Column [PrimaryKeyColumn] -- Insert that into your other big table Insert Into [YourOtherBigTable] Select * From #tmpBigTable -

Convert GUID to varchar(32)

痴心易碎 提交于 2019-12-03 23:42:58
How can I convert a GUID which is 36 characters to a VARCHAR(32)? I'm trying to copy data from one table to another. There are two similar columns from these two tables. Table1.colx is a GUID so it is 36 characters in length in total due to the hyphens The corresponding column is table2.colx but it is a VARCHAR(32) I am looking for a way to convert a GUID to VARCHAR, but I've got to remove the hyphens. So far I have been unsuccessful in my attempts to find a way to do this. I assume this is SQL Server, from the SSMS tag. Convert the GUID to a string, then replace the hyphens with empty strings

SQL Server Management Studio: See Object Explorer Details for objects in this folder

霸气de小男生 提交于 2019-12-03 23:31:37
I am working with a database hosted at GoDaddy using Microsoft SQL Server Management Studio (version 10, for SQL Server 2008). I am getting this message: See Object Explorer Details for objects in this folder probably because they have more than 2500 databases there. I can still access everything from the Object Explorer Details, but it's a pain when you have to do it everyday. Does anyone know any way to get the database I am working on to appear in the Object Explorer on the left? It looks like this is a bug in SQL Server Mangement Studio. From Microsoft ... The current limitation of 2500

How to write a parametrized query in management studio?

*爱你&永不变心* 提交于 2019-12-03 23:00:51
From a client application I tyipically do: select * from table where Name = :Parameter and then before executing the query I do :Parameter = 'John' These parameters are not a Search&Replace but real parameters passed to the server. Since I need to test some of those queries in detail, how can I write the query in management studio? I want to write the query with parameters and give a value to the parameter. How can this be done? Update: To remove confusion here I add info to better express myseld. when I execute a normal query I see in sql server profiler select * from table where Name = 'John

How to Stop SSMS 2012 from scripting SPs using sp_executesql

只谈情不闲聊 提交于 2019-12-03 22:25:12
I realise this is a very similar question to Stop SSMS from scripting SPs using sp_executesql? However, they seem to have changed the behaviour with SSMS 2012. If you have the 'Check for existence' option selected, as in: ... it now generates an IF NOT EXISTS for the proc about to be created, as well as an IF EXISTS for the previous drop proc, if, as I usually do, I select the DROP and CREATE option: This forces it to script the CREATE using sp_executesql. It's pointless, since you don't need the IF NOT EXISTS check on the CREATE, if the DROP has just dropped it. It doesn't seem possible to