sql

sql: sqlite: server side paging

I have a client talking with server program(using sqlite3 as the storage) which needs to support paging. I am thinking about how to implement that. One approach: 1) user request page 1 a. execute query from sqlite3 b. return the first page range items to client 2) user request page N a. execute query from sqlite3 b. return the ...

GUI tools for mysql 5.0

Is their any GUI-interface for MySQL, like Microsoft SQL Server 2005 Server Management Studio provides? Because basically I am operating MySQL with command prompt interface. ...

comparing 2 consecutive rows in a recordset

Hi, Currently,I have this objective to meet. I need to query the database for certain results. After done so, I will need to compare the records: For example: the query return me with 10 rows of records, I then need to compare: row 1 with 2, row 2 with 3, row 3 with 4 ... row 9 with 10. The final result that I wish to have is 10 or less...

Need high-performance query

Possible Duplicates: Concat groups in SQL Server How to use GROUP BY to concatenate strings in SQL Server? I need a very high-performance query: This is the original table that I am querying: userID group 1 A 1 B 1 D 2 E 2 G 3 Null The result I need is li...

Help with sql query

table 1: id1, name, surname table 2: id1, id2, value id1 is a foreign key for table 2 What is the fastest query to find the table 1 records that do not have a record in table 2 with value = c ? Can you please help me? ...

Suggestions for my database design (Networking Users on the website)

Imagine a scenario where - All the users on the website can be affiliated to each other, i.e. something like be "friends" with each other and all. The Database i want to design should be able to handle connections like these - Suppose A is a friend of B (also implies B is a friend of A) wants to connect with D who is a friend of C who is...

How do I delete multiple rows with different IDs

I want to do something like this: ... DELETE FROM table WHERE id IN (SELECT ....) How can I do that? ...

Inserting Selected Row onto SQL Server Database from GridView

protected void Authorise(object sender, EventArgs e) { CheckBox chk; foreach (GridViewRow rowItem in GridView1.Rows) { // gets the Debit Reference number for each row checked string type = GridView1.DataKeys[rowItem.RowIndex].Values[0].ToString(); // gets t...

Oracle SQL Developer. Find referenced views of synonyms

Hello in the PL/SQL Developer beneath the category synonyms there is a tab (referenced by), which displays referenced views of a synonym. On my system there is no PL/SQL Developer installed. So is there any function in the normal Oracle SQL Developer or a query how I can retrieve the same information as in the PL/SQL Developer ? Thanks...

SQL Command cannot be converted to string

Here's my code I seem to be getting an error SQL command cannot be converted to string with this code Dim LogData2 As sterm.markdata = New sterm.markdata() Dim query As New SqlCommand("Select * from openquery (db, 'SELECT * FROM table WHERE person=@person')") query.Parameters.AddWithValue("@person", Session("number")) Dim drCode2a A...

insert query syntax problem

i have a SQL query as follows String S = Editor1.Content.ToString(); Response.Write(S); string sql = "insert into testcase.ishan(nmae,orders) VALUES ('9',@S)"; OdbcCommand cmd = new OdbcCommand(sql, myConn); cmd.Parameters.AddWithValue("@S", S); cmd.ExecuteNonQuery(); Error: Column 'orders' ca...

Max within a timeframe with date duplicates

I have a table like this DateTime start_time not null, DateTime end_time not null, Status_Id int not null, Entry_Id int not null I want to get the count of each status within a time period, where only the last started is valid for a given entry_id. What I am using now is this (with dynamic dates): with c (Status_Id, Entry_Id, Start_...

SQL Server - How do I query a table for matches with keywords from another table?

I have two tables: Job, and JobKeyword. JobKeyword contains three fields: Id, JobId and Keyword, so every Job has its JobKeyword-s. How can I use SQL Server Full Text Search so it will query the Job table, with keywords from the JobKeyword table? This is my current SQL: WITH JobRN AS ( SELECT TOP (@End) searchTable.*, ROW_NUMBER()...

sql query error

i have a SQL query as follows String S = Editor1.Content.ToString(); Response.Write(S); string sql = "insert into testcase.ishan(nmae,orders) VALUES ('9',@S)"; OdbcCommand cmd = new OdbcCommand(sql, myConn); cmd.Parameters.AddWithValue("@S", S); cmd.ExecuteNonQuery(); Error: Column 'orders...

Help with this query

Please can you take a look at this query and point out what I'm doing wrong: update @output set fromdate = o.fromdate, todate = o.todate from ( select fromdate, max(todate) from @output as o left join status as es on o.number = es.empid and o.ccode = es.compcode and @status = es.status ) I'm try...

data type for text formated as.. bold italics underline and other properties

I want to save the contents from HtmlEditor(Ajax Control) into a database field. If i try to save as VARCHAR than error comes as data too long. Please help. ...

How should I deal with null parameters in a PL/SQL stored procedure when I want to use them in comparisons?

I have a stored procedure with a parameter name which I want to use in a where clause to match the value of a column i.e. something like where col1 = name Now of course this fails to match null to null because of the way null works. Do I need to do where ((name is null and col1 is null) or col1 = name) in situations like this or i...

Aliasing a linked server?

I have a server which I need to have as a linked server to another server, using sp_addLinkedServer. My server's name is in the format "DepartmentName.CompanyName.com", which I can usually change to [blah.blah.com], but which I can't use in the SQL Server Management Studio View creator, because it keeps deleting my square brackets... O...

SQL Optimization

How to optimize this? SELECT e.attr_id, e.sku, a.value FROM product_attr AS e, product_attr_text AS a WHERE e.attr_id = a.attr_id AND value IN ( SELECT value FROM product_attr_text WHERE attribute_id = ( SELECT attribute_id FROM eav_attr WHERE attribute_code = 'similar_prod_id' ) AND val...

Explanation of particular sql injection

Browsing through the more dubious parts of the web, I happened to come across this particular SQL injection: http://server/path/page.php?id=1+union+select+0,1,concat_ws(user(),0x3a,database(),0x3a,version()),3,4,5,6-- My knowledge of SQL - which I thought was half decent - seems very limiting as I read this. Since I develop extensive...