sql

i want to add a column in my table

there is already some columns added in my table starsin.. i want to add a column address in my table starsin by using a query.. ...

Update a list of things without hitting every entry

I have a list in a database that the user should be able to order. itemname| order value (int) --------+--------------------- salad | 1 mango | 2 orange | 3 apples | 4 On load from the database, I simply order by order_value. By drag 'n drop, he should be able to move apples so that it appears at the top of the li...

Got a minus one from a read call.

I connect to a database with read only access using SQL developer. It's a TNS connection. I use a tnsnames.ora, forwarding port script and SQL Developer. In the past, occasionally, when connecting, I get a error message Got a minus one from a read call. Vendor Code 0 If I do a reboot, it goes away. Another friend suggested changed the ...

Can't figure out what's wrong with my php/sql statement

So this is probably a dumb beginner question, but I've been looking at it and can't figure it out. A bit of background: just practicing making a web app, a form on page 1 takes in some values from the user, posts them to the next page which contains the code to connect to the DB and populate the relevant tables. I establish the DB c...

row convert to column in sql 2008

I want to convert a series of rows into a series of columns create table #cusphone(cusid int,cusph1 int) insert into #cusphone values(1,48509) insert into #cusphone values(1,48508) insert into #cusphone values(1,48507) insert into #cusphone values(2,48100) so that the output is like this 1 48509 48508 48507 2...

Sorting SQL query results in Java

Firstly my apologies for putting some large text here. Below is the result by executing SQL query in Java but I want it to short it out using timestamp. For eg. TimeStamp in the below 1st line text is - 040501(HH:mm:ss) (like wise all data contains timestamp) (Sorting should be done by using timestamp parameters) (Each line given belo...

"Remember" last three MySql queries; Cookie, passed variable or other method?

I have a classified website, with pretty sophisticated searching, and I am about to implement a function where the last three queries is displayed for the user, so that the user can go back easier through the queries. This because for each query the user has to provide a lot of input. I have four questions for you: I wonder, how can I...

Slow queries in Rails- not sure if my indexes are being used.

I'm doing a quite complicated find with lots of includes, which rails is splitting into a sequence of discrete queries rather than do a single big join. The queries are really slow - my dataset isn't massive, with none of the tables having more than a few thousand records. I have indexed all of the fields which are examined in the que...

Saving multiple items per single database cell...

Hi, i have a countries list. Each user can check multiple countries. Once saved, this "user country list" will be used to get whether other users fit into countries certain user chose. Question is what would be the most efficient approach to this problem... I have one, one to save user selection as delimited list like Canada,USA,Franc...

make thread with method take sql connection

how to use ParameterizedThreadStart in c# I want to make threads take void method and this method take sqlconnection ? ...

How to get multi row data of one column to one row of one Column

Hi friends, I need to get data in multiple row of one column. For example data from that format ID Interest Sports Cooking Movie Reading to that format ID Interest Sports,Cooking Movie,Reading I wonder that we can do that in MS Access sql. If anybody knows that, please help me on that. ...

hash password in SQL Server (asp.net)

Is this how hashed password stored in SQL Server should look like? This is function I use to hash password (I found it in some tutorial) public string EncryptPassword(string password) { //we use codepage 1252 because that is what sql server uses byte[] pwdBytes = Encoding.GetEncoding(1252).GetBytes(password); byte[] hashB...

Linq to SQL - what's better?

db.Albums.FirstOrDefault(x => x.OrderId == orderId) or db.Albums.FirstOrDefault(x => x.OrderId.Equals(orderId)) ...

radgridview delete update in asp.net

i have written the follwing to display data from the datagrid and den insert new rows but how do i perform update and delete plss help here's my code using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; usi...

Test the sequentiality of a column with a single SQL query

Hey, I have a table that contains sets of sequential datasets, like that: ID set_ID some_column n 1 'set-1' 'aaaaaaaaaa' 1 2 'set-1' 'bbbbbbbbbb' 2 3 'set-1' 'cccccccccc' 3 4 'set-2' 'dddddddddd' 1 5 'set-2' 'eeeeeeeeee' 2 6 'set-3' 'ffffffffff' 2 7 'set-3' 'gggggggggg' 1 At the end of a transaction that makes several type...

combining results of two select statements

I'm using T-SQL with ASP.NET, and c# and i'm pretty new to SQL. I was wondering how i could combine the results of two queries Query1: SELECT tableA.Id, tableA.Name, [tableB].Username AS Owner, [tableB].ImageUrl, [tableB].CompanyImageUrl, COUNT(tableD.UserId) AS NumberOfUsers FROM tableD RIGHT OUTER JOIN [tableB] INNER JOI...

SQL Server, Select CASE with different casting

I want to do a select that do a cast only for a specific ID but it doesn't seems to work. Example : SELECT CASE WHEN(@ID <> 1) THEN Code WHEN(@ID = 1) THEN Cast(Code AS int) END Code FROM .... Any Idea ? ...

What's the best way to store sort order in SQL?

The guys at the top want sort order to be customizable in our app. So I have a table that effectively defines the data type. What is the best way to store our sort order. If I just created a new column called 'Order' or something, every time I updated the order of one row I imagine I would have to update the order of every row to ensure ...

alias some columns names as one field in oracle's join select query

Hi We are developing something like a social networking website. I've got task to do 'follow me' functionality. In our website objects are users, teams, companies, channels and groups (please don't ask why there are groups and teams - it is complicated for me too, but teams are releated to user's talent) Users, teams, channels, compani...

SQL: convert backup file from copy format to insert format

I have a PostgreSQL backup made with PHPPgadmin using Export > Copy (instead Copy > SQL which is actually what I need). File contains entries like this: COPY tablename(id, field) FROM stdin; ... How to convert this file to SQL format? INSERT INTO tablename... I want to use Pgadmin to to import this file using execute SQL command. ...