sql

Problem in adding data in sqlite3

I am having a date datatype to be added into the database but i dont know how to insert the date datatype into the database ` +(void)insertbarcodeid:(NSString *)barcode brand:(NSString *)brand productname:(NSString *)productname productsize:(NSString *)productsize productcategory:(NSString *)productcategory productopendate:(NSDate *)prod...

MERGE Command in SQL Server

Hi folks, I have been using the statement insert into target select * from source where [set of conditions] for a while. Recently found this MERGE command that will be more effective to use for my purpose so that I can change the above statement to MERGE target USING source ON [my condtion] WHEN NOT MATCHED BY TARGET THEN IN...

convert sql query for different database

Is there a tool to convert form one sql query of one Database to another . > eg for sqite CREATE TABLE ConstantValues( Id int > AUTOINCREMENT primary key , > VariableName varchar(50) , Values > varchar(150) ) for sqlserver > CREATE TABLE ConstantValues( Id > INTEGER identity(1,1) primary key , > VariableName varcha...

Create dummy data with WHILE

Hi, I am pretty new in TSQL, I try to insert some dummy data inside my table using a WHILE, but it run really really slow. I was thinking maybe I am writing not properly the code, could yo please have a look and confirm it? thanks -- Insert dummy data DECLARE @i int, @Content int; SET @i = 5001; WHILE @i > 5000 ...

Source of sequence?

hi, I want to use source code of some sequences but i am unable to find it in ALL_SOURCE data dictionary. Please let me know where i can find source code for sequences used . ...

Calling stored procedure from Java / JPA

Hi, I am writing a simple web application to call a stored procedure and retrieve some data. Its a very simple application, which interacts with client's database. We pass employee id and company id and the stored procedure will return employee details. Web application cannot update/delete data and is using SQL Server. I am deploying ...

[Oracle] Which select Statement has better performance ?

Suppose master_table contains many records and both the "id" field of the master_table, tableA,tableB,tableC and tableD are the same in the business sense. For the 2 select statements shown belows , Will they both return the same result set? Which one will have better performance ? I think if both tableA_tmp ,tableB_tmp,tableC_tmp ...

How to Convert.ToByte[] sql reader?

I am saving a image into database with byte[] property like this: ProfileModel: private byte[] _imageData; public byte[] ImageData { get { return _imageData; } set { _imageData = value; } } When I am trying to read image i have problem with converting of byte. I dont know how to convert reader...

Issues updating a MySQL table using Python's MySQLdb.

I am trying to UPDATE a MySQL table using Python's MySQLdb module. Although the query seems fairly simple it just won't update the information. Here is my code: for username,info in users.iteritems(): if info[0] > 0 and info[1] > 0: month = 8 year = 2010 cursor.execute(""" UPDATE users_disk SET ...

Empty ResultSet after executing PreparedStatement

Hi, When I execute sql query SELECT * FROM TABLE (TEST.getDevices()) in SqlDeveloper I've got about 200 rows, but when I try to execute it in java: //cut here String query = "SELECT * FROM TABLE (TEST.getDevices())"; PreparedStatement stmt = null; ResultSet rset = null; try { stmt = oracleConnection.prepareStatement(query); ...

Need Help Writing SQL To Apply Promotions to Shopping Basket at Checkout

Hi All, Don't laugh but I'm a Lotus Notes (non-relational database!) developer trying to work with SQL and, although I have the basic concepts nailed, I'm stuck on something I'd consider to be "advanced". Imagine a user reaches an online checkout having added a set of products to their basket. I need to apply promotions to the basket....

SQL SELECT distinct rows from a table by multiple columns ignoring columns order (significance)

I have a table People (First_Name, Last_Name). This table has records that are duplicated as in the example (not all rows are duplicated): First_Name Last_Name John Smith Alec Baldwin Smith John Angelo Gordon Mary Bush Bush Mary How do I select all distinct people? In the final output of the que...

Oracle sql script

How can i write an sql script for updating 10 row's date for 10 different users ...

The OLE DB provider "MSDASQL" for linked server "(null)" reported an error.

Hi all, I'm very very stuck here, help is greatly appreciated. What am I trying to do? There is an ASP-page (classic ASP) with a CSV upload that gives the following error: Microsoft OLE DB Provider for SQL Server error '80040e14' The OLE DB provider "MSDASQL" for linked server "(null)" reported an error. The provider did not give any...

Send mail by SQL server 2005

i am not getting this store procedure , can you tell where is it "master..xp_sendmail" i have send the mail when any insertion take place in particular table like "Emp" ...

Nhibernate Criteria/SQL Query problem

Hi I have a querry that returns a large number of rows. I want to know if there is a way to decrease query time without changing the results. One smsblast contains multiple smsresponses and smsresponse contains multiple smsstatuses. Variables status = int smsBlastId = int var queryStatus = DetachedCriteria.For<SmsStatus>() .Add(Re...

How can I select the "maximum" row from a table?

How can I select the maximum row from a table? What does maximum mean -- well my table has two timestamp columns, TIME1 and TIME2. The maximum column is the one with the latest value for TIME1. If that is not a unique row, then the maximum is the one within those rows with the latest value for TIME2. This is on Oracle if that matters...

Find storedProcedure by name

Hello, Is there any way I can find in SQL Server Management studio StoredProcedure by name or by part of the name ? (on active database context) Thanks for help ...

When i run PHP script using built in server SQL database is access wheni run same script with apache database is not accessed

<?php $db_host = "IQRA"; $db_user = "iqra17"; $db_pass = ""; echo $db_host; $sqlconnect=odbc_connect($db_host,$db_user,$db_pass); $sqlquery="SELECT companyName FROM Customers;"; $process=odbc_exec($sqlconnect, $sqlquery); echo $process; while(odbc_fetch_row($process)){ $companyName = odbc_result($process,"companyName"); echo "$co...

What is the most efficient way to restore multiple databases in SQL 2008

Hi all, I'm in the process of doing a large scale server migration, as such I have to move 50+ SQL 2005 databases to a new SQL 2008 server installation. The DB guys have only given me a backup of each database, so I have a directory with some 50 .bak files sitting in a directory (ie c:\db) that I need to restore. I need to restore ea...