sql

How can i solve "Either the parameter @objname is ambiguous or the claimed @objtype (COLUMN) is wrong." ?

If I try to execute below query: EXEC sp_rename 'ENG_TEst.[ENG_Test_A/C_TYPE]', 'ENG_Test_AC_TYPE', 'COLUMN' I get an error: Either the parameter@objname is ambiguous or the claimed @objtype (COLUMN) is wrong. How can I solve it? ...

Dynamically create Blob in DB2 Java stored procedure

I would like to return some data as a Blob from a DB2 stored procedure written in Java. This is the code to generate the procedure on the DB2 server: CREATE PROCEDURE CLUB.P_CLUB_GET_BACKUP ( IN CLUBID INTEGER, IN BNR INTEGER, OUT BACKUP BLOB(50000000) ...

MySQL select, between, AND, OR clause and query problem

I have a table named item with two attributes (code and name). Now i want to group them in the following way: group a: code between (5300 and 5310),(7100,7200),(8210,8290) group b: code not between (5300 and 5310),(7100,7200),(8210,8290) How can i do it using MySQL query? ...

How to do 'grading' in pure (i.e. ANSI) SQL

I have a table that looks something like this: CREATE TABLE student_results(id integer, name varchar(32), score float); Lets make the following two assumptions: assume that the score goes from 0 to a maximum of 100. assume that I want to grade students in 'step sizes' of 10 so I want to apply the following grading: Score Gra...

Any tool to convert mysql store procedure to ms sql server store procedure?

Hello all, I have to migrate database from mysql to ms sql server 2005.I imported table successfully, now i need to convert store procedure written in mysql to ms sql server 2005.i need to convert a ton of sp so manual conversion is a tedious task, is any tool or simple way to convert sp of mysql to sql server 2005. ...

finding the last consecutive row

I need some help with a query. I have this simple table: CREATE TABLE `consecutiv` ( `id` int(11) NOT NULL auto_increment, `readVal` int(11) default NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM AUTO_INCREMENT=16 DEFAULT CHARSET=latin1; insert into `consecutiv`(`id`,`readVal`) values (1,2),(2,2),(3,2),(5,3),(6,3),(7,3),(8,3),(9,...

Does a Join table (association table) have a primary key ? many to many relationship

Does a Join table (association table) have a primary key ? many to many relationship. I've seen some Join tables with a primary key and some without can someone please explain when you would have a primary key in a join table and why? Thank you in advance;-) ...

What is the best way to store Binary data (images, pdf's, mp3's, videos ect) in mysql and why?

What is the best way to store Binary data (images, pdf's, mp3's, videos ect) in mysql and why? What i would love to know is how you do it(as developers) and why? Also how the big sites do it? Thank you in advance ;-) ...

How to automatically backup a SQL Server database on my ISP's location from my own pc?

Hi, I have very limited access to the SQL Server at my ISP. I have a very simple tool to create databases and execute SQL (which is enough most of the time) but now I also want to backup (and in the case of an accident, restore) a database from my own PC (or via a web application, if that's possible, both are ok) Is there a tool which...

metaphone for asian languages

I'm writing a data import tool in sql. I'm using single and double metaphone for finding possible incorrect and duplicate data. Metaphone works fine for English like languages (French, Spanish,... ) but it doesn't work for asian languages (chinese, arabic, hindi,..). Is there any similar algorithm exists for these languages. ...

Printing an ER Diagram for mySQL database (800+ tables)

We have a system built by Parallels, which is relying on a huge (800+) tables to maintain everything. I need to learn this system, in order to be able to write queries to retrieve data for report generation on various needs. I am obviously, having difficulties isolating which tables are currently relevant for the task at hand, so I tho...

Continued:- can not use SqlAdapter ot DataSet or anything - just SqlCommand

You may refer to this post of mine http://stackoverflow.com/questions/3092121/sql-going-nuts-does-not-accept-parameters Simply put I don't have a choice I have to take input of which table the user wants and what the user wants from that table. Please suggest a secure way to achieve this, within the limitations of the code Thank you....

How should i execute and get the result of a query which is stored in a column as a data value

How do I execute a Sybase query which is stored in a column of another Sybase table? Suppose that "SELECT COLa FROM TABLE_A" is stored in a column called 'command' in a separate table (table_log). I want to find a way that allows me to execute this query and get the answer. ...

Check empty Guid in SQL

Hello everyone! How do I check is argument in SP Empty Guid or not? Thanks. ...

SQL Trigger insert

Hi Guys, What is the best way to set up a trigger to get all new rows in a table and insert them into a work queue table. Many Thanks Sp ...

No Result Returned From SQL Query

I am running the following query, but no rows are returned even though a record exists that should match the query. SELECT * FROM tblsignup WHERE usr_email='[email protected]' AND (status=1 or status=2) ...

Oracle utl_nla_array_dbl does not exist

Hi all, Trying to get ordinary least squares regression going using the UTL_NLA package in Oracle. The UTL_NLA package is installed by default and appears to be working. Next up, I tried to run some of the regression sample code (OLS_Regression) that ships with Oracle (olsexmpl.sql and olstype.sql). I am able to create the model just ...

How to optimize SQL query with calculating distance by longitude and latitude ?

Hello ! I have a table with structure like that: table name: shop id_shop int(10) name varchar(200) latitude double longitude double And I'd like to calculate distance between given coordinates and coordinates saved in database. My current query: SELECT * FROM `shop` AS `s` WHERE ( ( 6371 ...

Complex sum with grouping

Hi I have table called Games with columns: Player1Id, Player2Id, Player1Points, Player2Points. Sample data: Player1Id Player2Id Player1Points Player2Points --------- --------- ------------- ------------- John Piter 4 1 John Adam 2 10 Piter Adam ...

MySQL query - Join data based on two factors, then customise the way the data is sorted based on values.

Hello, firstly I'm new to querying multiple tables so I apologise if this is a bit of a stupid question, but we all have to start somewhere! I've made a picture which should make this easier to understand: My first table wp_user has several columns - I want the values from 3 columns which are ID user_email and user_nicename. My seco...