Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    MYSQL




An Equivalent For @@ERROR Function In MSSQL


Has MySql someting like @@error in MSSQL? if no, how i can find dynamically that error occured and it's number?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
5.0 Stored Procedure Mssql EXEC Equivalent
Is there an equivalent to the mssql exec command that can be used in
stored procedures?

Stored Procedure Mssql EXEC Equivalent
Is there an equivalent to the mssql exec command that can be used in
stored procedures?

Equivalent Function
I use the following function in Oracle
SELEC T decode(status,'A','Active','L','Active','Former') FROM Table

What it means is: if status = A, return "Active", if status=L, return
"Active", else return "Former" in the select statement.

Decode in mysql has nothing to do with this functionality and I didnt see a
function while browsing the docs online that did this. Is there an
equivalent function in mySQL?

@@rowcount, @@error Equivalent
is there a '@@rowcount', '@@error' equivalent in mysql to use inside a
stored procedure after a query statement?

Function Error
I´m trying to create a function using SQL language however even the command below that I found in the MySql docs is not working, I always get the same error whe I try to create a function
Any suggestions ????


CREATE FUNCTION hello (s CHAR(20)) RETURNS CHAR(50)
RETURN CONCAT('Hello, ',s,'!');


Error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '(s Char(20)) Returns Char(50) RETURN CONCAT('HEllo,',s,'!')' at line 1 (State:37000, Native Code: 428)

Function For ERROR And/or ERRORNO?
This may seem like a silly question, but MySQL has the mysql_error & mysql_errno API functions. So why is there no similar ERROR & ERRNO that can be called from the command line?

Similarly, MS SQL Server, PostgreSQL, INGRES, etc. all have a
RAISE ERROR and/or RAISE NOTICE function to output messages to the user.
Why is there no similar functionality in MySQL?

The above seems like pretty basic functionality that was overlooked.

Finally, I searched throughout the MySQL site, mailing lists and forums, but I can find no way to formally request these enhancements. Does anyone know of how that is accomplished?

Error Messages In Function
First, I cannot use PHP or C. My requirements are for a pure MySQL interface.
I am using MySQL v5.0.Is there any way to output a message to the console from a FUNCTION?This is needed mostly for error handling, but all error handling functionality
seems to only point to PHP or C, which I cannot use.

In postgresql this is easily done with RAISE NOTICE 'msg';
Like in Ingres it can be done with WRITE 'msg';

But I am baffled that MySQL does not have any equivalent functionality.

Error:invalid Use Of Group Function
version:mysql 4.0.18 for win

hi,all dear:)

when execute sql-statement,
error raise:

update customer,cu_order set customer_point=0
where customer_keyid=order_customerid and
DATE_SUB(now(),INTERVAL 1 YEAR)=DATE_FORMAT(max(order_time),"%Y-%m-%d 23:59:59")

error:invalid use of group function

i beg someone tells me why?how resolve?

thx

Error: Call To Undefined Function Mysql_connect() .....
I'm running MySQL 4.1 with PHP 5.0.2 on Windows 2000. However I cannot
connect to the database. I receive the folowing error:

Fatal error: Call to undefined function mysql_connect() in C:Program FilesApache GroupApache2htdocsfilea.php on line 8

My system's particulars are:

1.
The system path on my system is set as follows:
C:WINNTsystem32;C:WINNT;C:WINNTSystem32Wbem;C:
Program FilesMySQLMySQL Server 4.1in;C:PHP5;C:PHP5ext;

2.
The php.ini file is set to the full path of the 'ext' directory in
my PHP installation, i.e.
extension_dir = "C:PHP5ext"
The "extension=php_mysql.dll" line is not commented in my php.ini file.

3.
The information page from phpinfo() does not include a
separate section called “mysql†as I believe it should.
The extension_dir in phpinfo() is set to C:php5

Can anyone tell me what I am doing wrong?

Fatal Error: Call To Undefined Function Mysql_connect()
I have recently installed ,on my OS Windows 2000, Apache Server 2,PHP 5 and MySQL Server 5.0(as Windows Service-starting automatically).

Although I have passed through all steps (which I learned after reading many forum posts) to configure php.ini-recommended (including renaming and copying it to C:WINNT) and added libmysql.dll,php5apache2.dll,php_mysql.dll,etc to C:WINNTSystem32, it seems that smth weird is happening.

On my screen appears :"Fatal error: Call to undefined function mysql_connect()" when I open a php file in my webbrowser, in order to test mysql connectivity.

Fatal Error: Call To Undefined Function: Mysql_connect()
i have to phpBB forums, until yesterday everything worked fine until yesterday. all of a sudden i get this error message (sometimes) when browsing the forums:

Fatal error: Call to undefined function: mysql_connect() in /home/gnahrung/public_html/forum/db/mysql4.php on line 48

i haven't changed any of the phpBB-files or the databases. when i get this error and i refresh the page the error goes away.

Error 1305 - Trying To Execute User Defined Function
In my investigation, I attempted to execute the function (named 'esp')
and I started getting the error message: (from database named XQ)

SELECT esp(0);
Error 1305 (42000): FUNCTION XQ.esp does not exist

So from there, I attempted to re-install it:

CREATE FUNCTION esp RETURNS INTEGER SONAME 'mysqlExtension.so';

I then get this back from mysql:

FUNCTION 'esp' already exists.

I also tried in vain:

DROP FUNCTION esp;

same message comes back:

Error 1305 (42000): FUNCTION XQ.esp does not exist

Not sure where this went wrong. It was working fine then something made

it go amok. In one case it says it exists, the other it does not.

Fatal Error: Call To Undefined Function Mysql_connect()
currently, im using PHP 5, apache 2, and mysql 5

im trying to create my first connection to mysql using PHP

but i got an error, says Fatal error: Call to undefined function mysql_connect()

anyone how to fix this?

Fatal Error: Call To Undefined Function Mysql_connect()
I downloaded PHP5 and MySQL 4.0.20A and installed them. However, I could not use my php script to create a database and got the undefined function call error. I would appreciate if someone could show me how to enable MySQL to communicate with php.

Fatal Error: Call To Undefined Function Mysql_connect()
found a couple of posts about this but still couldnt fix this problem

basically,

ive installed apache and php 5 all works great:

then i installed mySql, had alot of problems installing it but finally got the service running correctly.

when i run my php script it kicks up this error

Fatal error: Call to undefined function mysql_connect()


ive checked that all the SQL dlls are in the htdocs folder

aswell as making sure that the php.ini (this is in htdocs aswell) has the extensions mysql and mssql.dll uncommented.

and the my.ini file in C:/windows is :

[mysqld]
# set basedir to your installation path
basedir=C:/Program Files/Apache Group/
# set datadir to the location of your data directory
datadir=C:/Program Files/Apache Group/data
[WinMySQLAdmin]
Server=C:/Program Files/Apache Group/bin/mysqld.exe




ive rebooted and also restarted my services and still get the error.

Fatal Error: Call To A Member Function On A Non-object
I am wondering why I am getting the following error:
Fatal error: Call to a member function on a non-object in /home/blu6592/public_html/new/register2.php on line 46.
Here is the code that is on line 46:

PHP Code:

 $name_check = $db_object->query("SELECT username FROM comments WHERE username = '".$_POST['username']."'");

User-defined Function: ERROR 2013 (HY000): Lost Connection To MySQL Server During Query
With mysql-4.1.1-alpha, using any User Defined Function ( UDF) at the
query execution stage, on Linux 2.6, gave me the following error:

"ERROR 2013 (HY000): Lost connection to MySQL server during query"

However, upgrading to mysql-4.1.2-alpha seemed to solve the problem.

Both versions were configured exactly as follows

../configure --with-openssl --enable-thread-safe-client --with-mysqld-ldflags
=-rdynamic

The only way I could solve this was by upgrading to 4.1.2-alpha-log. Then,
recompiling the functions, drop the old UDF functions, then, recreate.
So far so good.

Anyway, if you run into this problem, or just want more detail on the sample
User Defined Functions that come with MySQL ( /sql/udf_example.cc), I've put
my notes in the following link ( TIP 27 )

MsSQL &
I've been using MsSQL for some time now to log users that are logging into our radius system.

what i'm having trouble with is the TIME feild.
i have it set to the standard DateTime feild in SQL,
but when i pull up the info i get see this:

28/07/2003 00:01 AM 42666 bps 30.4min
28/07/2003 24:13 PM 46666 bps Logon
28/07/2003 39:57 PM 40000 bps 75.8min
28/07/2003 43:30 PM 48000 bps Logon
28/07/2003 02:10 PM 42666 bps 18.6min
28/07/2003 45:59 PM 46666 bps Logon

why would it give me times like 45:59 PM ?

i've never seen this before, and was wondering if any one had any idea's as to why?

MSSQL To MySQL
I have this query:

Uninstall MSSQL?
I've had a few problems with my first attempt at installing MySQL - I can't seem to get the PC to connect with MySQL. I did notice that an SQL Server was running in the SQL Server Service Manager panel. It's a NetSDK - MSSQL Server thing.

Do I need to unistall that before MySQL will work properly?

Replication From MSSQL
Has anyone ever gotten transactional replication to work from MSSQL to
MySQL? I have done very rudimentary tables with 1 or 2 columns but I have
run into various errors at startup about invalid cursor state. Any insight
you may have is greatly welcome.

MySQL And MSSql 7
Can MySQL read a MS Sql 7 database?

MySQL To MSSQL
I currently have a MySQL database running on one of my web sites. Is it possible to export the SQL and execute it so that it will generate table structures on an MS SQL database?On another note, I used PHP & MySQL for Dummies, just wondering if there was a ASP & MSSQL equivalent?

MySQL Vs MSSQL
We have a PHP business system that we provide to our customers. The database is MySQL 5. We have a new potential customer that is hell bent on keeping everything within their existing MSSQL database. I'm wondering if there are substantial differences in query format between mysql and mssql. There are no stored procedures, however we do take advantage of mysql 5's sub queries.

MySQL Better Than MSSQL
What are some of the technical advantages that MySQL has over MSSQL? Other than source being available and the product being free?

MSSQL Emulate
What we'd like to do is use MySQL for Goldmine (FrontRange Solutions).  Is there a way to emulate MSSQL on the mySQL box without using WINE or VMWARE.  We're looking for a pure linux solution or at least a place to start looking.

Mssql Codes
how to convert store procedure from mssql codes like tis to mysql store procedures. Urgent thanks

Create PROC spVerifyLogin --verify student login
(@StudentID varCHAR(10),@StudentPwd varChar(15))
AS
if not exists (select StudID from student where StudID=@StudentID)
Return -200 --no student is detected
if exists(Select StudID from Student where StudID=@StudentID and StudPwd=@StudentPwd)
return 0

From MSSQL To MySQL Or PostgreSQL
I have been using MSSQL for a few years. Recently I am looking seriously for some free database platform. Both MySQL and PostgreSQL have a large community, anywhere I can find the comparison?

Compare MySql And MsSql
I am trying to switch from Microsoft MSSQL to the free mySql. But I am going to explain to customer the impact.

I want to know the following stuff.
1) What MsSQL can do but MySql cannot do?
2) What is the number of connections supported by each product.
3) Where (URL) can I find more information about the above issue?

Mysql To Mssql Converter
I need to export a mysql database to a mssql one. Can anyone recommend any good freeware to do this. I tried DTS via mssql but there are datatype problems and primary key data is not being transfered.

Importing Data From MSSQL
I currently have a database in MSSQL and am trying to import several tables into MySQL. On the MySQL Console Manager, there is a greyed out Import selection that will not allow me to use. I dont get it.

Then my next consideration would be a query to create the tables and insert it into the MySQL database.

Import Data From MSSQL
I have two systems, one using MSSQL and one using MySQL. On a daily basis, I need to import information from tables on the MSSQL database to a table on the MySQL database.
What's the easiest way to do this?

MSSQL -> MYSQL Method
I have an sql query that worked on MS SQL 2000.. I need to know what the mysql version needs to look like.

the MS sql query is as such:

Select CARTS.CARTNUMBER, CARTS.UNITPRICE, QUANTITY = (Select SUM(numitems) from selitems where SELITEMS.CARTNUMBER = CARTS.CARTNUMBER)

basicly thats an example of what im talking about.. It works in MS SQL but in mysql the same query gives me the error: "Microsoft OLE DB Provider for ODBC Drivers error '80040e14'

You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'Select SUM(numitems) from selitems where SELITEMS.CARTNUMBER"

Does mysql support this using a different method?

MySQL And MSSQL Transplant
I am quite proficient with MySQL databases but at my job they use MSSQL. Now, I know most SQL databases have somewhat the same syntax, but if I create a database in MySQL and dump it can I run import it to a MSSQL db? Mainly because I've noticed that the maximum value of a MSSQL int == 4 while in MySQL this is 11.

MYSQL / MSSQL Behaviours
I neet some Help for MySQL MSSQL.
There is a parameter in the "WHERE" part called "in Between".

for example:
... WHERE in Between 1 to 3

MY SQL prints all Values from 1 to 2 - exklusive the 3
MS SQL prints all Values from 1 to 3 - inklusive the 3

Is there a "between" parameter for MYSQL that makes the Output like MS SQL?

I know it is possible to use the following command:
">=1 AND <= 3" but I need the Result for "in Between".

Migrated MSSQL To MySQL
I have 2 applications that use MSSQL databases. One application is written in java, and the other one VB 6. Now... I migrated those same databases to mySQL, and made necessery changes in my applications to use mySQL. Java using J Connector and VB application using ODBC. More or less just changed the connection string. Following happened... Java application now have much better performance and works grate, BUT VB application works much slower. Both applications use some of the same databases so I guess it is not the performance of the mySQL that is the issue here but rather the connector.

Invalid Use Of Group Function (was "Baffled By Query Error")
trying to figure out why I keep getting this error with the following query:

SELECT c.account_id,a.name,a.company,SUM(c.agent_product_time) AS mins
FROM account a LEFT JOIN calls c ON c.account_id = a.id
WHERE c.calldate >= DATE_SUB(NOW(),INTERVAL 14 DAY) AND c.agent_id = 2
AND SUM(c.agent_product_time) >= '500' GROUP BY c.account_id ORDER BY mins

ERROR: #1111 - Invalid use of group function

IF Function,GROUP BY,aggregate Function Problems
Yep, I have all those problems in the title. So I'll explain each one at a time - I did have another thread relating to this very same query but I thought it was time to update where I am with the query because at the moment I feel like I am getting nowhere!

The query I have basically searches through an items_ordered table through each product and checks to see whether the item is VATable or not. This is not where I have the problem though. Where I am really having the first problem is when I am trying to use the IF function to check if the TOTAL of an order is over £300. IF it is then I multiply it my 0.95 (i.e. 5% off). With the query below I get no errors but neither do I get the desired result. It's as though it couldn't even see it. =....

What Is Your PL/SQL Equivalent?
Please advise what is your equivalent language to PL/SQL?

If I use mySQL, what would I use to write triggers etc...?

I am thinking of using mySQL instead of Oracle but I like PL/SQL and not sure what mySQL uses?

Migrating Form MSSQL To MySQL
I am migrating from MSSQL to MySQL and I'm having trouble converting the SQL strings.
I got thins:
CODE '' strSQL = "SELECT top 1" & strDbTable & "Author.Username, " & strDbTable & "Author.Author_ID, " & strDbTable & "Thread.Topic_ID, " & strDbTable & "Thread.Thread_ID, " & strDbTable & "Thread.Message_date "
'' strSQL = strSQL & "FROM " & strDbTable & "Author, " & strDbTable & "Thread "
'' strSQL = strSQL & "WHERE " & strDbTable & "Author.Author_ID = " & strDbTable & "Thread.Author_ID AND " & strDbTable & "Thread.Topic_ID"' IN "
'' strSQL = strSQL & " (SELECT top 1" & strDbTable & "Topic.Topic_ID "
'' strSQL = strSQL & " FROM " & strDbTable & "Topic "
'' strSQL = strSQL & " WHERE " & strDbTable & "Topic.Forum_ID = " & intForumID & " "
'' strSQL = strSQL & " ORDER BY " & strDbTable & "Topic.Last_entry_date DESC) "
'' strSQL = strSQL & "ORDER BY " & strDbTable & "Thread.Message_date DESC;"

MSSQL To Mysql COUNT() Possible Index
Well we are week 3 in our conversion to mysql from mssql. This one we had to rewrite the mssql version to mysql. We are having issues with a few count statments. Code:

Probs With MSSQL Server 2000
Well i have installed MSSQL server 2000 on my PC(OS:XP Prof). And the server does run as well as the agent. I know how to use the registration wizard of SQL server 2000, cause untill i sucessfully complete the registration process i woun't be able to create a database OR use the query analyser.

I know how to access the registration wizard, but i at last it gives me an error saying"access not granted, unsucessfull registration" **** like that.
:confused:

And i am using the same PC as the server as well as client.

Error Message Warning: Printf() [function.printf]
In my php code i have...


<?php
mysql_connect("localhost", "my-username", "my-password") or die(mysql_error());
mysql_select_db("my-database") or die(mysql_error());
$result = mysql_query("SELECT * FROM beavers_news ORDER BY posted DESC");
if ($row2 = mysql_fetch_array($result)) {
do {
Printf("<table width='100%'><tr><td>%s</td></tr><tr><td>Posted: %s</td></tr><tr><td>%s</td></tr></table>", $row2[title], $row2[posted], $row2[news]);
}while ($row2 = mysql_fetch_array($result));
}else{
echo "There is no news!";
}
?>


And i add news into the mysql database, but when i go to view the page i get the following error message...

Warning: printf() [function.printf (http://www.southwaterseascouts.org/scouts/news/function.printf)]: Too few arguments in /home/sites/southwaterseascouts.org/public_html/scouts/news/index.php on line 55

Link ODBC Or MSSQL Table With MySQL
I've noticed that it is (somewhat) possible to link MySQL or ODBC schemas into MSSQL Server but what I would like to do is link a MSSQL Server table to MySQL so that I can do cross-database joins.  Having trouble finding this functionality, however.  Does anyone know if there is a way or a tool out there to make a way?

MySQL Equivalent To *nix 'more'
How do I prevent the MySQL client to scroll pages when the results of a query exceeds the number of lines in the terminal window? Like a MySQL equivalent to *nix 'more'.

mysql> select foo from bar;
[...]

2500 rows in set (0.00 sec)

Equivalent Expressions
Given a primary key field `RecNo` -

Are there any performance reasons to favor one of these two otherwise
equivalant expressions?

SELECT MAX(RecNo)
FROM SomeTable;

SELECT RecNo
FROM SomeTable
ORDER BY RecNo DESC
LIMIT 1;

Dmax Equivalent
Up to now I've been using Access databases with ASP which has been working fine. I'm now converting the Access database to a MySQL one. One problem I'm having is with the DMax function in Access.

I'm trying to find a way of acheiving the same thing as DMax in a MySQL query.

I know I can use the MAX function, but I need to find the max record in another table and specify criteria for it which MAX doesn't allow.

Script in Access:
SELECT id, DMax("col2","table2","recordid=" & id) AS maxid FROM table;

Equivalent Boolean
I'm working with VB.NET and I'm pulling data from MySQL. .NET is looking
for a boolean value...and I'm wondering what type I should make the field in
my database.

Equivalent Of @@IDENTITY
In Microsoft SQL, there is a special variable called @@IDENTITY that always contains the primary key of the last entry that was inserted into a table.

Is there an equivalent of this in MySql?


Copyright © 2005-08 www.BigResource.com, All rights reserved