sql

SQL - Select statment using LastIndex

I have a resultset which has ProductURL stored : accessoires/abc/285/P187654 accessoires/abc/285/D18765432 accessoires/abc/285/A1876543 I need to get the final part of the URL i.e. anything that is after the final '/' that appears in the URL. I have a function which gives me the LASTINDEX : SELECT [LAST_INDEX] (ProductURL,'/') But...

oracle 9i get highest member of tree with given child

I have a parent-child relationship in an Oracle 9i database-table like: parent | child 1 | 2 2 | 3 2 | 4 null | 1 1 | 8 I need to get the absolute parent from a given child. Say, I have child 4, it has to give me parent: 1 I already looked to CONNECT BY , but I can't find the solution. ...

Sql Server 2008 check constraint

I have two tables, Table1 and Table2 with same primary key (FKTestID). If I want to delete one row in Table1 and same FKTestID are in Table2 it will not work. You can only delete a row from Table1 if Table1.FKTestID not equals any FKTestID in Table2. Please help me with this constraint? ...

how to do a iterative rollup in sql

Hi I want to do a rolling sum (of valx) based on previous row value of rolling sum(valy) and the current row value of valx valy=previousrow_valy + valx animal valx valy cat 1 1 cat 3 4 cat 2 6 dog 4 4 dog 6 10 dog 7 17 dog 8 25 ...

SQL database interaction

Hello everyone, I am making a database, which will interact with a SQL table. What I have achieved so far: Add rows to the table. Delete rows from the table. Search rows from the table. Paginate the results. What I need to achieve: A log in prompt when a guest tries to access the page. In fact, I have successfully installed a ...

Dynamic SQL string wildcard % causes 'Invalid Column Name' in Visual Studio

Sproc in SQL Server 2005 parses, compiles and runs successfully via SQL Management Studio. I've recently imported the schema into Visual Studio Database Edition 2008 and attempting to 'build' the project. The collation on both the database I generated the script from , and the 'temporary' design time database are the same (SQL_Latin1...

Creating Indexes for Group By Fields ?

Do you need to create an index for fields of group by fields in an Oracle database? For example: select * from some_table where field_one is not null and field_two = ? group by field_three, field_four, field_five I was testing the indexes I created for the above and the only relevant index for this query is an index created for fie...

How to create Linked Server with non-default port.

I want to create a Linked Server in MS SQL Server 2000 to a MS SQL 2005 Server which runs on port x (not the default port 1433). But it doesn't work, as I can't specify the port anywhere!? Using sqlcmd (specifying port x), I can connect to the server without problems - but I can't set it up as a Linked Server. How can this be done? ...

How to write a binary blob onto disk on Informix

I have some images in an informix database, as a binary blob field (jpg), how can i write the images onto disk with an SQL? ...

Inserting German date format in SQL using VBA

I'm pretty frustrated here, been trying this for days... All I want is for German users to be able to enter dates that should be stored in SQL Server. The dates are in the following format "dd.mm.yyyy". I always get error messages like this one: Syntax error in date in query expression '#23.01.2004 00:07:00#'. - using Access for now. I'...

Copy Table from one to another server

Can any body let me know how can we copy a table with the data in it exactly to another server. I would really appreciate your help. ...

How to retrieve the children categories without the children of those ones ?

Here is my statement : SELECT ( COUNT( parent.categoryName ) - ( sub_tree.depth +1 ) ) AS depth, CONCAT( REPEAT( '', ( COUNT( parent.categoryName ) - ( sub_tree.depth +1 ) ) ) , node.categoryName ) AS categoryName FROM Categories AS node, Categories AS parent, Categories AS sub_parent, ( SELECT node.categoryName, ( ...

Append to a Select Command

I have a Gridview that I want to filter. My gridview is in an update panel and my filter button is not. On button click i have the following protected void bttnfilter_Click(object sender, ImageClickEventArgs e) { if (TextBox1.Text != "") { SqlDataSource1.SelectCommand += " and field like '%' + @param + '%'"; SqlC...

MySQL "Sending data" horribly slow.

I have a modest-sized table, 277k records at the moment, which I am trying to do a FULLTEXT search on. The search seems to be very quick until it gets to the Sending data phase. The Table: CREATE TABLE `sqinquiries_inquiry` ( `id` int(11) NOT NULL AUTO_INCREMENT, `ts` datetime NOT NULL, `names` longtext NOT NULL, `emails` long...

Should I use a separate table to store online users or should I just use additional fields in the extant members table?

I'm working on an online system that allows users to interact socially and of course it will be important to be able to identify users that are in fact online. I know about HTTP being stateless and I know about using sessions, so I'll need to accomplish this by comparing the last active time of a user to an arbitrary expiration time. M...

tsql script to find tables not being used by stored procedures, views, functions, etc?

Is there a t-sql script to find out tables that aren't being used in sql server by stored procudures, views, functions, etc. I have a database that has 100s of tables, if not more and before I go dropping tables, I wanted to know if there was a script that could go through each object in the database and tell me if any tables are in use...

What timezone does MySQL's NOW() follow

Does MySQL's NOW() follow the system's timezone or some standard like GMT or UTC? ...

Error while creating a Membership user "The password-answer supplied is invalid"

I tried creating a new user using CreateUser method. but when I click create user button I get this weird error : "The password-answer supplied is invalid". I already tried putting a strong password (123$567) or a normal password(1234). I double it has anything to do with the password strengh because thats whould throw a different exec...

Positive or negative boolean field names

A table's boolean fields can be named using the positive vs the negative... for example, calling a field: "ACTIVE" , 1=on / 0=off or "INACTIVE" , 0=on / 1=off Question: Is there a proper way to make this type of table design decision, or is it arbitrary? My specific example is a messages table with a bool field (private/public)...

How to optimise a sql doublon checker

I would like to optimise my Doublon checker if anyone knows how it could be faster. $doublonchecker="delete bad_rows.* from eMail as good_rows inner join eMail as bad_rows on bad_rows.EMAIL = good_rows.EMAIL and bad_rows.EMAIL_ID > good_rows.EMAIL_ID"; $resultdoublon = mysql_query($doublonchecker); if (!$resultdoublon) { ...