sql

how can i change the pattern in php?

i got this pattern for searching purpose for mysql from third party javascript. im assuming its html pattern, which can be converted, anyone have any idea on this? pattern A%5B%D9%8B-%D9%93%D9%B0%5D*L%5B%D9%8B-%D9%93%D9%B0%5D*L%5B%D9%8B-%D9%93%D9%B0%5D* ...

Get seq number used by insert statement called from C# (oracle)

I need to insert a record into a table and set the value of a column (e.g. orderid) to a unique #. And return that number used. I thought the process would be to do use a sequence and an insert statement with nextval: insert into ordersTable(orderid) values(ordernums.nextval); But how to I get the number that was used? My thought i...

SQL Server NOLOCK and joins

Background: I have a performance-critical query I'd like to run and I don't care about dirty reads. My question is; If I'm using joins, do I have to specify the NOLOCK hint on those as well? For instance; is: SELECT * FROM table 1 a WITH (NOLOCK) INNER JOIN table2 b WITH (NOLOCK) ON a.ID = b.ID Equivilent to: SELECT * FROM table 1 ...

Strange cast error with Linq and Oracle

I am getting a cast error with Linq to a DataTable that was populated with Oracle. bool isTrue = DataTable.AsEnumerable().Any (x => x.Field<int>("MYNUMBERFIELD") == MYNUMBER); In SQL this works fine as expected. In Oracle is fails with a cast error on the cast. In C# code the same thing happens when you do the following: i...

how to convert an SQL server 2005 .mdf to SQL server CE .sdf ?

HI , I created a project where it can work with SQL server 2005. Now i want this project to be migrated to SQL server CE 3.5 which will run in low config system ( XP , 500 MHZ and RAM 488) How do i convert my .mdf to .sdf .I used third part tool lik e PrimeWork but when i am trying to load it says not compatible . any help ? ...

Implementing the Hacker News ranking algorithm in SQL.

Here's how Paul Graham describes the ranking algorithm for Hacker News: News.YC's is just (p - 1) / (t + 2)^1.5 where p = points and t = age in hours I'd like to do that in pure mySQL given the following tables: Table Posts with fields postID (index) and postTime (timestamp). Table Votes with fields voteID (index), post...

Efficient way to do batch INSERTS with JDBC

In my app I need to do a lot of INSERTS. Its a Java app and I am using plain JDBC to execute the queries. The DB being Oracle. I have enabled batching though, so it saves me network latencies to execute queries. But the queries execute serially as separate INSERTs: insert into some_table (col1, col2) values (val1, val2) insert into some...

How to use temporary tables in SQL

Please tell me how to make temporary tables in SQL. I am new to this area. ...

How this SQL Query in hbm.xml file can be written in source code?

I am trying to run a SQL query in Hibernate. I am using its documentation. Because of some unknown values i am trying to do inside the Source code. See this below SQL-Query configuration. How to re-write it in source code itself!! I tried this personList = session.createSQLQuery("SELECT person.NAME, person.AGE, person.SEX, address.STR...

NULL comparison, take 2

Hello all, I have a subquery, used in WHERE section: A.column <> B.column Unfortunately, it doesn't work, if either A.column or B.column is NULL. So, I converted it to: ((A.column <> B.column) OR ((A.column IS NULL) <> (B.column IS NULL))) , presuming that "Table.column IS NULL" is boolean value and I can compare 2 boolean values....

codeigniter multiple join conditions on same table

Basically i want to join a table where a col in table A matches a col in table B and where a col in table B is equal to 0. I am using codeigniters active record class. Thanks in advance. ...

Query to select tables with similar column values

Continuing to my subject "http://stackoverflow.com/questions/3767000/invalid-column-name-though-its-there" I wanna write a query that selects tables that has the values of the EntityId and DataclassId columns as identical values (skipping the nulls of course) Here is an example of my DB Table_1 ID Sequence Type Heigh Weight ...

sql query not printing

Hi Guys, I am trying to run a dynamic query but for some odd reason its not running. Its not even printing. Please can anyone tell me why is the below dynamic query not printing. DECLARE @CLIENTPK_NEW AS VARCHAR(50) DECLARE @CGNEEPK AS VARCHAR(50) DECLARE @TYPE AS VARCHAR(10) SET @CLIENTPK_NEW='6EF77AAA-1A7B-4D03-A448-D1088DED4134' SE...

problem in sql server 2005 database diagram

TITLE: Microsoft SQL Server Management Studio Express Database diagram support objects cannot be installed because this database does not have a valid owner. To continue, first use the Files page of the Database Properties dialog box or the ALTER AUTHORIZATION statement to set the database owner to a valid login, then add the database ...

variables in inline table valued function

I have a table valued function that requires three parameters. If any of the passed in parameters are blank I need to assign the parameter to null. Please can anyone advise me on how/where can i put the below if conditions in the function. IF @CLIENTPK_NEW = '' BEGIN @CLIENTPK_NEW=NULL END IF @CGNEEPK= '' BEGIN @CGNEEPK=NULL E...

SQL - SQL Trigger and Foreign Key Prob

I am facing an issue in Insert Trigger. I have 2 tables. Whenever I insert into Table 1, I have written a trigger to insert into Table 2. There is a stored procedure to insert in to Table 1 and there is an After Insert Trigger to insert into Table 2. The table 2 has one primary key and one foreign key. When there is a Primary Key const...

How to display Ford owners that don't own Ferarris in SQL

Hi, I'm learning SQL and I've written a query that returns all owners of Fords. How do I amend the query so that it doesn't return anyone who owns a Ford and a Ferarri? SELECT DISTINCT Owns.Pid FROM (Person INNER JOIN Owns ON Person.Pid= Owns.Pid) INNER JOIN Car ON Owns.Cid=Car.Cid WHERE Car.Manufacturer = 'Ford' Added: I tried th...

SQLite: accumulator (sum) column in a SELECT statement

Hi, I have a table like this one: SELECT value FROM table; value 1 3 13 1 5 I would like to add an accumulator column, so that I have this result: value accumulated 1 1 3 4 13 17 1 18 5 23 How can I do this? What's the real name of what I want to do? Thanks ...

importing CSV file into sqlite table

I've imported a CSV file into an sqlite table. everything went fine except it included quotes " " around the data in the fields. not sure why because there are no quotes in the CSV file. anyone know how to avoid this or get rid of the quotes somehow? Here's a screenshot from the firefox sqlite import settings I'm using: thanks for a...

C#: help return dataset and assign values to controls

I'm not really used to C# sharp but have used VB.NET before. I'm needing to set the value of text fields, dropdowns etc from data from a query. To enter the data I have been using a class Computer with the method saveComputer() that takes values from user controls. Now I want an edit page that uses the id from url & uses getComputer(id...