I am building a ASP.NET MVC application with Entity Framework and SQL Server. I have noticed that when I read back SQL Server columns of type nchar or text there will be added blanks at the end of …
Tag: sql
How to retrieve records for last 30 minutes in MS SQL?
I want to retrieve records for last 30 minutes in a table. How to do that? Below is my query.. select * from [Janus999DB].[dbo].[tblCustomerPlay] where DatePlayed < CURRENT_TIMESTAMP and …
Why doesn’t SQL Server support unsigned datatype?
I am specifically thinking about unsigned int. Here is a practical example: what do you do when your identity column maxes out? It’s possible to either go BigInt (8 bytes storage instead of 4) or to refactor the application to support negative integers, and even to create your own rules as indicated in …
Is there a way to list open transactions on SQL Server 2000 database?
Does anyone know of any way to list open transactions on SQL Server 2000 database? I am aware that I can query the view sys.dm_tran_session_transactions on SQL 2005 (and later) database versions, however this is not available on SQL 2000. Answer For all databases query sys.sysprocesses For the current databas…
SQL Query merging with PHP assistance please
I want to sort the messages by poster_time instead of the usual id incrementing as I have restored a database with auto incrementing id’s and very old messages show up on top I had like to be able to sort them by poster_time to fix that problem. I’ve attempted to fix this myself but I don’t …
Mysql SELECT CASE WHEN something then return field
I have two field nnmu and nnmi , and reverse, At first everything looks good, but somehow it mix up values, it work when nnmi and nnmu both are equal to 0, but when either value is 1 it returns nonsense. Any help? Answer You are mixing the 2 different CASE syntaxes inappropriately. Use this style (Searched) O…
Make all store images the base, small and thumbnail images in Magento?
I have a Magento store that has around 3,000 products. Almost all of these products have a single image attached to it. For some reason, even though I set the small image and thumbnail image as the …
How to group latitude/longitude points that are ‘close’ to each other?
I have a database of user submitted latitude/longitude points and am trying to group ‘close’ points together. ‘Close’ is relative, but for now it seems to ~500 feet. At first it seemed I could just group by rows that have the same latitude/longitude for the first 3 decimal places (roug…
Expression language to SQL where clause transformations?
We have one domain object, I’m looking for a simple expression language that we can write that will generate SQL. (particulary the where clause of SQL) For example. translates to Does anything like this exist, or do I have to write my own? Please let me know if you think I might as well be searching for…
Getting the Last Insert ID with SQLite.NET in C#
I have a simple problem with a not so simple solution… I am currently inserting some data into a database like this: kompenzacijeDataSet.KompenzacijeRow kompenzacija = kompenzacijeDataSet….