[Solved] How to insert byte[] array with ORMlite into image column

In ServiceStack.OrmLite v4, as specified by mythz in the comments, everything should work as-is. In v3, if you want to have byte arrays serialized as binary instead of base 64 strings, you should inherit from SqliteOrmLiteDialectProvider and override the functions responsible for converting CLR values from and to SQL values to handle byte arrays. public … Read more

[Solved] T-SQL to generate expect result

Assuming that I understand the problem: you have a number of rows with sections (“Cates”) and symbols (“Type”); if there are any symbols ending in a minus sign then these indicate a row without a minus sign should be removed; symbols are never “mixed” per section, i.e. a section can never have “A” and “B-“; … Read more

[Solved] select yesterday date in where condition

SELECT * FROM yourTable WHERE (FilteredPhoneCall.createdon >= dateadd(day,datediff(day,1,GETDATE()),0) AND FilteredPhoneCall.createdon < dateadd(day,datediff(day,0,GETDATE()),0)) OR (FilteredPhoneCall.modifiedon >= dateadd(day,datediff(day,1,GETDATE()),0) AND FilteredPhoneCall.modifiedon < dateadd(day,datediff(day,0,GETDATE()),0)) solved select yesterday date in where condition

[Solved] How should I calculate the average speed by road segment for multiple segments?

When averaging speeds, the harmonic mean is in need. The straight forward AVG() approach is wrong, the arithmetic mean yields the wrong result for average velocity. There is no predefined function for the harmonic mean, but it could be achieved with this query: SELECT segment, COUNT(*)/SUM(1e0/speed) AS avg_speed FROM T GROUP BY segment SQL Fiddle … Read more

[Solved] Want to the check the records existing in the date range in sql server [closed]

Try this with myTable ( numberid, startDate, endDate ) as( select numberid, CONVERT(DATETIME,startDate), CONVERT(DATETIME,endDate) from ( values (4405598510,’2011-08-06 00:00:00′,NULL), (2418680054,’2011-08-06 00:00:00′,’2011-12-28 00:00:00′), (4405598510,’2011-08-06 00:00:00′,NULL), (1810168034,’2011-08-06 00:00:00′,NULL), (6849266569,’2011-08-06 00:00:00′,’2014-09-02 00:00:00′), (2682265222,’2011-08-09 00:58:00′,’2012-09-20 00:00:00′), (6253123963,’2011-08-09 00:00:00′,’2011-07-01 00:00:00′), (8276745680,’2011-08-10 00:00:00′,’2014-06-27 00:00:00′), (3873103800,’2011-08-10 00:00:00′,’2013-07-16 00:00:00′), (3703761027,’2011-08-06 00:00:00′,NULL), (1810168034,’2011-08-06 00:00:00′,NULL) ) [ ] (numberid,startDate,endDate) ) select Numberid, startDate, endDate, case … Read more

[Solved] Need SQL Script

If the possible values are only ‘Breachend’ and ‘Not Breached’, you can GROUP BY incident_number and get the minimum as ‘Breached’ < ‘Not Breached’. SELECT incident_number, min(has_breached) has_breached FROM elbat GROUP BY incident_number; 1 solved Need SQL Script

[Solved] Microsoft SQL Server: how to put together these three tables? [closed]

Join the tables, concatenate the strings and use LIKE to look for the “certain text”. SELECT p.path + ‘\’ + d.filename FROM documents d INNER JOIN documentsinprojects dp ON dp.documentid = d.documentid INNER JOIN projects p ON p.projectid = dp.projectid WHERE p.path LIKE ‘%certain text%’ AND d.filename LIKE ‘%certain text%’; 4 solved Microsoft SQL Server: … Read more

[Solved] This procedure not working

The problem is not at the procedure it is at the calling. When you call the stored procedure, you need to declare and pass in the required parameter declare @NAME VARCHAR(50), @CITY VARCHAR(200), @MOBILE NUMERIC(20) execute GETDETAIL @AGE = 21, @NAME = @NAME OUTPUT, @CITY = @CITY OUTPUT, @MOBILE = @MOBILE OUTPUT SELECT @NAME, @CITY, … Read more