Structured Query Language (SQL) is a language for querying databases. Questions should include code examples and table structure. This tag refers to the standard language, not for questions about specific vendor extensions, like MySQL or Microsoft SQL Server, so if you think your question relates to ...

learn more… | top users | synonyms (5) | sql jobs

1
vote
0answers
5 views

mdf file is corrupted now how can i recover my ms sql server 2008 database

My database .mdf file got corrupted and I have no means to get my schema s.I tried with a few soft wares available on the internet but its turns out that all of them being demo versions don't give ...
0
votes
1answer
11 views

Sql nested queries execution performance

Following is my nested sql query : Select M.UserID, SUM(M.Browser) From ( Select UserID, X.Browser From ( SELECT UserName, PCMLogEventID, MAX(Browser) ...
-1
votes
0answers
7 views

$wpdb->insert don't work

I am trying to learn with WordPress Plugin and I have a problem. I want to insert something into my database. The table is already created. I just checked that. Okay. This is my table: id ...
-2
votes
1answer
33 views

Convert in stored procedure ms sql

I have stored procedure where select and filtering data. For example : select CONVERT(nvarchar,[Date],120) , [FirstName] , [LastName] FROM myDB WHERE (@Date IS NULL OR @Date = '' OR [Date] = @Date) ...
1
vote
1answer
27 views

Update table row with certain id while deleting the recurrent row [Sql, Sql Server]

I have 2 tables Table name: Attributes attribute_id | attribute_name 1 attr_name_1 2 attr_name_2 3 attr_name_1 4 ...
0
votes
0answers
17 views

max consecutive time out of spec sql

I am trying to get the consecutive time out of spec for a set of readings in sql. This is the longest individual stretch for the period considered. The structure is a logger table with the mapping id ...
-1
votes
1answer
19 views

SQL query to select all WHERE datatype = datetime

I have to find all the columns in a table where the datatype for that column is datetime. Any ideas on how to do this? IE Select * FROM Table1 WHERE datatype = datetime.
0
votes
3answers
21 views

Oracle 11g: only return a value if row is first or last in group

I'm trying to create a report from an Oracle query. The data is like this: GROUP_ID | COUNT_1 | COUNT_2 1 | 100 | 123 1 | 101 | 123 1 | 283 | 342 1 | ...
0
votes
1answer
14 views

PIVOT concept in sql server

I am having a Stored Procedure as shown below: ALTER PROC [dbo].[USP_GetDraftQuoteByQuoteID] (@QuoteID int) AS BEGIN SELECT cl.Quote_ID,cl.PECCode,lpu.Description,cl.Site_ID,cl.Quantity FROM ...
0
votes
0answers
29 views

MYSQL: Select changed row

i have already ask for something similar... 1 - create table changes(snapdate date,value int, uid int, rid int); insert into changes values ('2013-04-22', 0, 1, 111 ), ('2013-04-21', 1,1,111 ), ...
0
votes
0answers
12 views

Enforcing foreign key “group” integrity in tables without creating redundancy

(I'm using SQL Server 2008 R2 but I'm not sure that's important) If I have the following "base" tables: SettingTypeCategory - SettingTypeCategoryId (PK) - CategoryName SettingType - ...
0
votes
0answers
22 views

TSQL - date range calculation with different records in column

I used to only have these kind of records in my "period"-column: CW 01, CW 02,...,CW 21 To retrieve only a certain range of calendar weeks I used this statement: Select Period,...., where ...
0
votes
0answers
31 views

remove default sort from sql query and

I want to get records sorted as they are in the query : SELECT `month`, SUM(order_quantity) AS order_quantity FROM" + "( SELECT MONTH(date_livraison) AS month, COUNT(*) AS ...
0
votes
1answer
15 views

Asp.Net multiple join tables issue from Sqldatasoruce Query Builder into one gridview

In Visual Studio 2010 with ASP.NET 4, I am trying to join several tables together to put the results in a gridview and details view with sqldatasource. In the sqldatasource wizard I have chosen to ...
-2
votes
2answers
36 views

Optimizing a query written with multiple subqueries

I am looking into ways to optimize the following query which uses a lot of subqueries because they tend to deteriorate the speed of the query. Although the following query works fine, it completes in ...

1 2 3 4 5 9186
15 30 50 per page