I have an SSRS report that I need to embed in the body of an email using the sp_dbmail stored proc in SQL Server. I'm able to do this using the front end of Outlook by attaching the .mhtml export of the SSRS report using the "Insert as Text" option w... more
I am working with a third party application and am trying to extract meaningful information about shift information based on the data.
I have following situation: I'm working on project where data base contains hundreds of tables, and very often I know what table I need to generate script for, but finding it in the list of all tables takes a lot of time. I would like to know, is the... more
Say I have data for 1000 users on my DB and someone new signs up. I want them to have an easy to way find contacts already registered - via their phone number. Something very similar to WhatsApp, Allo, Instagram, Twitter etc. do - they allow you to s... more
For my c++ program, I use jobs.yml which contains information about jobs in yaml format like:
Then I use yaml-cpp library for parsing fil... more
I want to fetching Records On the Basis Of Entered Keywords in the Search Bar.
Suppose I have Below 3 Records in My SQL Table's Column
Beautiful Small Kid.
Beautiful Rabbit in the Zoo.
Now, If the Search Query contains Beautiful... more
I am not so into database (I am using MySql) and I have the following doubt about the **unique constraint setted on a nullable field
So from what I know the UNIQUE constraint ensures that all values in a column are different.
But what happens if I ... more
SQL Server 2012. I wonder if anyone can figure out this problem I have.
I want to find all the different combinations people have ordered articles. I'm not interested if the person have bought a A and B and an other ordered B and then A. I want the... more
This is more of a puzzle really. Its probably been asked elsewhere before, but I couldn't find anything so I thought I'd share the question.
I'm trying to implement some kind of load balancing in an application and have reduced the problem down to ... more
I got a question, is there a possibilty, that a DDL Trigger can grant roles right after the user is created.
CREATE OR REPLACE TRIGGER DDL_TRIGGER
AFTER CREATE ROLE ON DATABASE
And after that, the trigger should grant the new user wi... more
I've got a running app (where I created Users through a scaffold) and only now stumble upon the "devise" gem. Now I'd like to include this in my app and manage Users through it. I was thinking that I could maybe drop the db,
rails generate devise U... more
This is a continuation of a previous question: Find groups with matching rows
I have a table which contains people and the cars that they own
| Name | Model |
| Bob | Camry |
| Bob | Civic |
| Bob | Prius ... more
I am trying to calculate Open column based on the following scenario.
For a unique sales order + sales_order_item, if Billed_Item is NULL, Open = Order_Quantity.
If Billed_Item is not null then Open = Order_Quantity -
Billed_Quantity until the sum... more
I have a table called BIO with some biological description that I want to query for keywords in mysql.
For example I want to query for "LTR", so I used the code:
select * from BIO where info LIKE '%LTR%';
The result was:
1 Adenylate is... more
Suppose, I have a list of string which is sent from client, in this case regions. And I have a table named Compliance Regions. I want to search for the rows which has a name property and region item should be exist on the row.
In the LINQ, I can do... more
Lets say I know a lot about the distribution of my data, and therefore know the optimal execution plan for a query.
Is there a way to specify my own execution plan, fully circumventing table statistics and the optimizer?
Lets say I have the following table:
User | Date_start | Date_End | Task
Al | 1/11/17 | 1/14/17 | Dishes
Al | 1/09/17 | 1/15/17 | Paint
Al | 1/11/17 | 1/14/17 | Dishes
Al | 1/18/17 ... more
Consider the following T-SQL code (MS SQL Server 2014) that fetches a random row from a table variable:
DECLARE @priceClasses TABLE (
INSERT INTO @priceClasses VALUES
,(1, 'W... more
I am using SQL Server 2008 R2. When I execute the following query, ISNUMERIC is evaluating to true(1) when the barcode clearly has 'D' inside it.
If I execute the same code with other letter than D or E, it seems... more
I am trying to get the Hijri GETDATE() and convert it into this format yyyymmdd
I have already tried this script
SELECT CONVERT(VARCHAR(10), GETDATE(), 131)
but it gives me this format ( 16/06/1438 ) and what I actually need is (1438/06/16)
I have a Windows service developed in C#. This service imports data from XML files into a SQL Server database, into different tables. These XML files are large. A particular file of 500 MB size takes more than 1 hour to import into tables with millio... more
I found this post about speeding up distinct queries:
Super-fast DISTINCT using a recursive CTE:
DROP TABLE dbo.Test;
data INTEGER NOT NULL,
Following remarks on my previous question, I describe here the problem that led me to have a database schema with enumerated columns, leading to poor performances.
(see edit at the bottom of this question for my overall conclusion)
I work with gene... more
I have these two queries and I want to add them
SELECT count(*) FROM table2 GROUP BY table1_id
SELECT count(*) FROM table3 GROUP BY table1_id
I tried something similar to the accepted answer in this question. The difference is that I have a group ... more
I've while loop inside while loop and both loops do some modifications of one table. I receive an error that table already exists. Below simple example of this problem. Could someone clarify why this doesn't work? I know how to bypass this problem in... more
Thanks a lot for your help.
I have a locations and ads table. Location has_many :ads
I perform the following query on Location Model.
@locations = Location.joins(:ads).where(@location_params.require(:location).permit(:id)).includes(:ads)
Then I wa... more
I'm learning SQLite from this webiste: SQLite Tutorial.
I was reading the article they had on the AUTOINCREMENT command.
My question had to do with their explanation of why this feature is useful:
The main purpose of using AUTOINCREMENT attribu... more
This is an example of my table. I have multiple entries on multiple rows for a given post_id (this is metadata for posts).
post_id | meta_key | meta_value
________ __________ ___________
1 | _theDate | 2016-03-31
1 ... more