I tried to search for a previous answer but the most similar is on a completely different question.
On TOAD for Oracle when I press F5 on an update I still have to choose if I want to commit or rollback.
On SSMS the commit is automatic.
Can I configure it to the need for an explicit commit?
EDIT
I've found that my question has got an exact response here:
https://stackoverflow.com/a/8748818/196210
You can set implicit transactions in SQL-Server Managemenet Studio. Therefore you have to change the default option from off to on here:
Tools
Options
Query Execution
SQL Server
ANSI
SET IMPLICIT_TRANSACTIONS
Here is an image:
Put BEGIN TRANSACTION at the top of your script.
Or use SET IMPLICIT_TRANSACTIONS ON (courtesy of How do you set autocommit in an SQL Server session?)
Related
Is there any way to force SSMS (SQL Server Management Studio) 15 to create a column in the designer with the default data type that I want, in this case nvarchar(100) instead of nchar(10).
Interestingly, there are a few ideas about this on the web, involving changing the registry, however when I do this and restart SSMS the registry just reverts back to nchar(10).
This makes me wonder if there is now a setting or an option inside SSMS to achieve this? I have expanded every tree in the options and I cannot find anything there.
I would actually consider a plug-in at this point.
You can modify these values altering specific keys in the registry.
Look for registry keys named:
SSVDefaultColumnType
SSVDefaultNCharLength
Depending on the exact version of your SSMS installation you can find these keys in different paths.
For example using SQL Server Management Studio 17.9.1 you can find these keys in the following path:
HKEY_CURRENT_USER\Software\Microsoft\SQL Server Management Studio\14.0\DataProject
I changed these keys' values to varchar(50):
Now my default type/size in the table editor have changed to:
I decided to post an answer because the behaviour of SSMS is a bit more complicated.
Firstly, for version 18.5.1 (latest, the version I am using) the registry path is:
HKEY_CURRENT_USER\Software\Microsoft\SQL Server Management Studio\18.0_IsoShell\DataProject.
It's not difficult to find the path and the keys, as others have already stated.
However the problem was not finding the keys, it was that SSMS was reverting the registry keys back when I was restarting the editor after making the change. Since the editor is saving those keys on closing, and I was making changes after failing to succeed (with the editor still open), the keys were always being overwritten.
The trick is to close SSMS before changing the registry, something I wasn't doing previously. Every article on this subject states having to 'restart the editor after making the changes', whereas the correct advice would be to 'close the editor before making the changes'.
Hopefully someone else having the same problem will find this useful.
I am using Light switch on Azure.
After I modified a column in a record when I click the Save button I got
"Store update, insert, or delete statement affected an unexpected number of rows(0). Entties may have been modified or deleted since entities were loaded, Refresh ObjectStateManager entries.
I use VS 2012 on my dev machine debug this light switch app. it works fine and no errors when I modify the save column on same records then save it.
Is anybody in this forum has idea what could cause this? and how should I work around it?
I suspect the azure machine don't have the same version of EF with my dev machine. but in the Light switch project both client and server reference I could not find the EF is referenced there. So I don't know how I can bring the EF dll on my machine up to Azure machine.
Anybody could give me some suggestion on this?
Thanks
Chris
Usually it's a side effect of Optimistic Concurrency. This article can give you the idea of it in Lightswitch:
LightSwitch 2012 Concurrency Enhancements
When it's working on dev machine and it's not working on Azure, I guess something is not right in your production database.
you can also take a look at Entity framework: affected an unexpected number of rows(0)
Having Instead of insert/update triggers, sometimes SQL server does not report back an IdentityScope for each new inserted/updated row. Therefore EF can not realize the number of affected rows.
Normally, any insert/update into a table with identity column are immediately followed by a select of the scope_identity() to populate the associated value in the Entity Framework. The instead of trigger causes this second step to be missed, which leads to the 0 rows inserted error.
You can change your trigger to be either before or after insert or tweak your trigger by adding following line at the end of it:
select [Id] from [dbo].[TableXXX] where ##ROWCOUNT > 0 and [Id] = scope_identity()
Find more details in this or this thread.
I used SQL Server Management Studio to create 3 tables using SQL statements.
Then I attempted to create an ADO object in Visual Studio. The ADO wizard saw my database, but not the tables I created.
Is this because I need to somehow commit the changes I've made in Management Studio?
Or do I need to add some kind of prefix to the table names like:
CREATE TABLE mydb.Table1 ... ?
Or could this be a permissions thing?
Or am I not waiting enough time (1 min or so) for the ADO wizard to grab the table names from the database?
Ah, I guess when you script the creation of your tables (or anything else you're adding) you need to add this:
USE [Interview_MicahHoover]
GO
So much for relying on the ETL guy to set things up ;)
I figured this out by using the GUI to create the table, then right clicking on the new table in the left menu and saying 'CREATE TO ... clipboard', pasting into notepad, and looking at how the SQL Server Management Studio did it.
Is there a way to show the SQL query executed by phpPgAdmin as the way phpMyAdmin does?
For example, if I modify a column, it should show the ALTER command being executed.
If this is not possible, what other interface could I use to get this feature?
It's not possible with any currently released version of phpPgAdmin, although the feature could probably be added. You'd need to intercept the SQL being sent to the back-end, and then display this back out to the user. SQL execution is pretty well centralized, and if you look at the "history" feature you will see a way to trap/show queries, so munging those bits together would probably get you what you want. HTH, if someone implements this, please send a pull request!
As a quick dirty hack you could alter sources a bit to enable sql logging:
In classes/database/ADODB_base.php in
function execute($sql) {
...
}
add these lines at the beginning:
global $misc;
$misc->saveScriptHistory($sql);
This worked in my 5.0.3 version.
In the free application SQL-Developer (provided by Oracle), I tried searching around for this but couldn't immediately find a solution. I find the opening of multiple SQL query result window/tabs mildly annoying. I'm sure there are very useful cases for this feature, but my question is:
Can we turn the multiple query result windows to just one (Toad style). If there's a shortcut key for this, that would be super awesome.
SQL Developer 4.0 (2013)
Close all the Query Result tabs
Tools > Preferences
Database > Worksheet > uncheck "Show query results in new tabs"
So, it turns out this is a bug. If you look closely, you'll notice that for each query run, your results tab is automatically being pinned, causing each new query run to need it's own new tab to display the results.
The automatic pinning is only supposed to be enabled when you explicitly go into Tools->Preferences->Database->Worksheet->"Automatically Freeze Result Tabs".
It is an identified bug, that Oracle fixed with SQL Developer 2.1.1.
Go to oracle.com and download the latest version and this should go away. It was definitely very annoying.
Instead of "Run Statement" click on "Run Script"(F5). This would give the output of two queries in the same Query Result window.
Directly to the database or from an application? Do you mean returning one result set from multiple tables together or multiple result sets in one pane? Are you using SQL 2000, 2005, 2008, or something else? The question is vaguely worded, but I'll try to help anyway.
For the purposes of this answer, I think you're trying to query the database directly. Open SQL Server Management Studio 2005 or newer (Not sure if this works in 2000), click New Query, and type the multiple queries into the pane. i.e.:
select * from table1
select * from table2
will return two result sets in the same window/pane.
Unpin helps keep current tab for next query.
(I am using Oracle SQL Developer 22.x)
I found that this was happening in SQL Dev v4.0.2.15 because I was running 2 SELECT statements. Running one SELECT at a time re-used the Results tab.