Tag Info

Hot answers tagged

22

@@identity returns a numeric(38,0). You'll need to cast it to get it to an int. SELECT CAST(@@identity AS INT) Also, try using scope_identity instead. If you have any triggers on the Customers table, you may end up getting the last identity from another table. Finally, since you're using dapper, you'll want to wrap all of that inside a stored procedure ...


10

It depends on what the queries are. ORMs are usually really good at CRUD, as they are usually simple. The more complex the query, the greater the chance of a bad query. You can tweak the generated queries by tweaking the LINQ statements. Sooner or later though, you'll get tired of fighting and use SQL queries or stored procedures for anything that is ...


9

Create table says: "IDENTITY Indicates that the new column is an identity column. When a new row is added to the table, Microsoft® SQL Server™ provides a unique, incremental value for the column. Identity columns are commonly used in conjunction with PRIMARY KEY constraints to serve as the unique row identifier for the table. The IDENTITY property can be ...


5

"Why would SELECT @@IDENTITY return a decimal" Because it might be too large to fit in an int - it does not match the type of the identity column but as Richard says returns a numeric(38,0) (numeric and decimal are synonyms)


5

Even though the statements are executed in sequence, if they exist inside the same transaction, you must issue some kind of checkpoint between queries or tweek the transaction isolation level before starting the transaction. There are four values for tx_isolation: READ-UNCOMMITTED READ-COMMITTED REPEATABLE-READ (default) SERIALIZABLE You could set the ...


5

Here is what I am seeing I see three queries, all almost identical. UPDATE people SET company_id = 1610, name = '<name>', password = '<hash>', temp_password = NULL, reset_password_hash = NULL, email = '<redacted>@yahoo.com', phone = NULL, mobile = '<phone>', iphone_device_id = 'android:<id>-<id>', iphone_device_time = ...


4

Individual queries are ok One of the biggest performance 'issues' with ORM tools (Entity Framework, Linq, LLBLGen, NHibernate, etc...) is not so much the performance of the individual queries that are executed (most are just CRUD calls which are retrieving a single record back based on a primary key). Incorrect use of Lazy Loading = Bad Performance It ...


4

DBMS_OUTPUT.GET_LINES is the way to get them back programmatically. Call it the same way as any other procedure. Or for a single line (which is probably easier to code) DBMS_OUTPUT.GET_LINE


4

First, tell your customer to get a real disk. Using a remote disk this way is exactly why you are having difficulty at this stage, and it could very well lead to a corrupt / unrecoverable database. You are rolling the dice every time this drive goes offline, even if only temporarily. Next, check the status of the database: USE master; GO SELECT state_desc ...


3

Syntax errors Immediate causes for the error: WHERE id = select currval('mytable_id_seq'); And a missing semicolon at the end of the DO statement: ... $do$; Better query On a closer look, this does not seem to be another case of UPSERT. It would seem one of the inserted columns needs to depend on multiple input values in combination with the freshly ...


3

You can't use it against SQL Server. It was in DTS: http://sqlservercode.blogspot.com/2006/05/chaos-isolation-level-in-sql-server.html And is in SSIS: http://msdn.microsoft.com/en-us/library/microsoft.sqlserver.dts.runtime.dtscontainer.isolationlevel.aspx


2

If you are using csv , you can not do this. But if you are willing to use other tools like Microsoft SQL Server Reporting Services or Crystal Reports you may do this. SSRS Chart Example, here another one with code example. If you can not install Reporting Services Server or do not want to, you can still use it for basic reporting purposes. Take a look at ...


2

If I understand you correctly: You'd use BatchSize to break the load into chunks eg 10k rows UseInternalTransaction determines if each batch is a transaction So: BatchSize = 0 -> UseInternalTransaction is irrelevant BatchSize > 0 -> Apply UseInternalTransaction is specified FYI, to monitor a SQL Server load in a non-blocking fashion select count(*) ...


2

Here is the complete PowerShell code. It is inspired by this C# example. It was a bit difficult to find, because an unsolved question was spamlike reposted a hundred times. if ($ora_loaded -eq $null) { $ora_loaded = [System.Reflection.Assembly]::LoadWithPartialName("Oracle.DataAccess") } $ConnectionString = "Data Source=YOUR_TNS;User ...


2

The 'answer' was that the ADO.Net providers in SSIS are basically useless and an embarrassment to the '.Net' moniker. They flake at more than a few thousand rows and are so hobbled as to be effectively useless. Basically, just stick to the old OLEDB providers and everything will be fine.


2

Another way, similar to what I proposed to your previous question: Return a set of well known type. Since your column list is dynamic, create a temporary table for the purpose. This announces the type to the system. As a side-effect you get a temp table to keep results for the duration of the session - like you needed in your last question. CREATE OR ...


1

At the time of this writing, there is not public repository for Connector/NET, if you have performance/scaling improvements you are welcome to contribute them (together with a bug report) at bugs.mysql.com.


1

Your stored procedure, itself, in a vacuum, as written now, does not appear vulnerable to SQL injection... but that is not the only consideration, and is not the final answer. It's always possible that it could be updated later and become vulnerable, but there's yet something else to consider. For a much bigger potential problem, take one step back and ...


1

Did you control PATH Environment Variable to which comes first, 32 or 64. Which ever client is installed last, change PATH accordingly. I have encountered similar issue. Windows uses PATH environment variable to decide which dlls to load. I have two clients installed in my machine and used PATH variable to force which one to use. ...


1

Thoughts: Any triggers on the table? What happens when the PK is dropped? Or what happens when you load a key-less staging table, before loading the real table? Is the log or data file growing? (aka has it been previously shrunk by some clever person)


1

Rolando's answer was certainly helpful in getting us on the path to the right solution. However we didn't ultimately adjust our autocommit configuration, our isolation levels or the innodb_locks_unsafe_for_binlog configuration. We believe the deadlock log we posted on this first question is a result of the deadlock we subsequently found and posted here. ...


1

So it turns out these two queries were at least part of the problem we were having. We have modified these two queries from: db.Execute("UPDATE people SET iphone_device_id=NULL WHERE iphone_device_id=@0 AND people_id<>@1", DeviceID, m_User.people_id); db.Execute("UPDATE people SET company_id = 444, name = 'Dad', password = '<pass>', ...


1

Linq to SQL and Linq to Entities (Entity Framework) are some different implementations. The first one is older and more lightweight ORM then the second one. Somebody likes using the first one because of performance. Here is some links to find out differences between these technologies: Entity Framework vs LINQ to SQL LINQ to SQL vs ADO.NET Entity Framework ...



Only top voted, non community-wiki answers of a minimum length are eligible