I have various reasons for needing to implement, in addition to the identity column PK, a second, concurrency safe, auto-incrementing column in a SQL Server 2005 database. Being able to have more than one identity column would be ideal, but I'm looking at using a trigger to simulate this as close as possible to the metal.
I believe I h...
Is it possible to programmatically find the database context from a tsql script? ie the context that changes when you add a USE . I ask because I am not using a USE, and would like to find the database name the script is running on.
...
I'm working with some code that generates ICriteria queries for NHibernate. They get executed using ActiveRecord and ActiveRecordMediator.FindAll()
For certain queries, I need to optimise them by adding on an OPTION (HASH JOIN) hint at the end of the SELECT statement. Is there a quick way I can do this?
I don't want to rewrite the qu...
When using Blob-fields in n-to-m-relations Hibernate and MSSQL are failing for some reason.
SQL Error: 421, SQLState: S0001
The image data type cannot be selected as DISTINCT because it is not comparable.
...
could not initialize a collection: [Dataset.documents#someID]
My classes look as follows:
@Entity
class Dataset {
@OneToMa...
More of a warning than a question:
We resolved a very puzzling bug this morning. We have a variety of reports that allow users to enter date ranges they want to run. The assumption is, if you ask for a report from 8/1/2010 to 8/10/2010 you meant to include 8/10/2010 so the end-date of the report isn't 8/10, it's something after that.
I...
Hello,
I'm in a situation where I came into a new job and I have to support several legacy systems. The original developer is no longer around. These legacy systems are really hammering away at our SQL Server and killing performance. I know that there are a lot of things that can be done in the code, but rewriting code is really my la...
A have a string %c3%ad which decoded with UTF-8 is í, but decoded with ASCII is Ã.
I need to decode it using the UTF-8 encoding, how can I do that?
Here is a select of the value and what it should be...
SELECT
('%c3%81') as 'Á (81 = 129)',
('%c3%89') as 'É (89 = 137)',
('%c3%8d') as 'Í (8d = 141)',
('%c3%93') as 'Ó (93 = 147)',
('%c3%...
Using SQL Server 2000 and Microsoft SQL Server MS is there a way to create a delimited string based upon an unknown number of columns per row?
I'm pulling one row at a time from different tables and am going to store them in a column in another table.
...
Hello,
following background: i have a Table-valued Function that returns a Table that is a kind of filtered view(views can not be parameterised) on a large table. Now i need many row count values on different conditions. Is it possible to get all count values in one query without having to query this function for every condition?
For th...
Is there any simple way to create a column in MS SQL that will track the last time a record was updated?
I would like to have two fields. One to track when the record was created. That one is simple. Create a datetime field and set its default to getdate(). However the second field seams to be a bit more tricky. I want it to have the la...
here is the config file for mysql
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">org.gjt.mm.mysql.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost/test</property>
<property name="hibernate.connection.username">root</property>
<property na...
how do we implement dynamic stored procedure and do they relate to dynamic functions and dynamic queries in sql server ?
Kindly enlighten...
...
I have a multithreaded C# application where each thread has it's own set of db connections. Each thread uses TransactionScope / DTC. Sometimes, I get a "The transaction has aborted" exception. It's not from a timeout since it occurs in less than 2 seconds from starting the transaction.
Here's the stacktrace:
at
System.Transacti...
I have an asp.net mvc calendar application (using jquery ui datepicker) and i am running into a weird situation where when i test on a US webserver i see a certain date and when i test on a London web server i see a different date (the date before)
Here are the details:
I am storing a date in sql server as:
2010-09-16 00:00:00.000
...
I am trying to build a recommender system based on user clicks. so far, i am not very concerned with all the nodes. i just wanted a way to develop a mechanism to detect that when a user clicked on A, he clicked on B. and when the user clicks on B, he clicks on C. so basically, in this node:
a > b > c
Its not very important for me to be...
Getting this error:
System.Data.SqlClient.SqlException : The conversion of a datetime2 data type to a datetime data type resulted in an out-of-range value.
My Entity objects all line up to the DB objects.
I found only a single reference to this error via Google:
http://ramonaeid.spaces.live.com/blog/cns!A77704F1DB999BB0!182.entry
Af...
In SQLServer 2005, is it possible to migrate a database from a workstation to another and also take the Replication configuration with it?
I mean, besides creating scripts.
...
How to make my local SQL Server Express (which part of Visual Studio) available from outer network?
...
Hello,
Sorry, I'm not even sure how to ask this exactly... but I wrote a website with logins. For that, I made my own users and passwords tables and hashed the passwords myself. Now, I would much rather move to Microsoft's built in membership provider with asp.net in sql server. Does anybody know a good way to migrate over?
The only re...
I have the following table layout. Each line value will always be unique. There will never be more than one instance of the same Id, Name, and Line.
Id Name Line
1 A Z
2 B Y
3 C X
3 C W
4 D W
I would like to query the data so that the Line field becomes a column. If the value exists, a 1 is applied in the field ...