I have a T-SQL script that implements some synchronization logic using OUTPUT clause in MERGEs and INSERTs. Now I am adding a logging layer over it and I would like to add a second OUTPUT clause to …
Tag: sql
LINQ to SQL, select from an inheritted class
Using LINQ to SQL and Object Relational Designing; Let’s say we have a class Animal with two inherited classes, named Cat and Dog. We can load the “Animal” class and its properties easily: However, when trying to load Cat or Dog, dataContext has the attribute of neither Cats nor Dogs. How is…
SQL select multiple max rows where ID is same
i’ve struggled again and again on this, but can’t get it to work. been on these forums for hours now… Data set: Row Date AccountID Column 1 1 21/02/2013 0:30 A0M8FA1003YP . 2 21/02/2013 0:30 A0M8FA1003YP . 3 21/02/2013 0:30 A0M8FA1003YP . 4 24/09/2007 12:00 A0M8FA1003YP . 5 24/09/2007 12:00 …
Indexing distinct values for a column
I have a table containing a column authors that contains names of authors for different articles (different rows). I want to add a new column that contains a unique index for every author,i.e. let’s say 12 for every occurrence of Dickens (just a random pick) in the author column. Can it be done by a MyS…
Calling SQL Defined function in C#
I have written this scalar function in TSQL: create function TCupom (@cupom int) returns float as begin declare @Tcu float; select @Tcu = sum (total) from alteraca2 where pedido = @cupom …
python – how to check if table exists?
I’m using this function : def checker(name,s) MY_T = “SELECT count(*) FROM `”+session.SessionInfo.Name where EventName=’”+name+”‘” I want to check if the table exists, how can I do it ? I …
Select row with most recent date per user
I have a table (“lms_attendance”) of users’ check-in and out times that looks like this: I’m trying to create a view of this table that would output only the most recent record per user id, while giving me the “in” or “out” value, so something like: I’m pr…
Change values before insert into table / PostgreSQL
Ive got the following problem. I want to change some values of INSERT statement, e.g. there’s a query: INSERT INTO table(a,b) values(x,y); But table has also another column c. I want to check (…
mongoDB vs mySQL — why one is better than another in some aspects [closed]
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, …
Formatting bigdecimals sql oracle
To have a readable big numbers under oracle and to facilatet the reading, I’m looking for a way to add blank space to obtain something like that: 213537592384.236 ===> 213 537 592 384.236 The problem that I have big numbers like above. Answer Spaces are a curious separator, and not directly supported…