Showing posts with label function. Show all posts
Showing posts with label function. Show all posts

Thursday, March 29, 2012

Error from sys.dm_db_index_physical_stats "No exceptions should be raised by this code"

I'm setting up a routine to do some reindexing. To get the info I need I'm trying to use the new function. The DB I think is causing the problem does pass DBCC CHECKDB. I'm not sure why I'm getting this but can not find anyone else that is getting this same error.

When I run this....

SELECT *

FROM sys.dm_db_index_physical_stats (NULL, NULL, NULL, NULL, 'detailed')

I get this....

Location: qxcntxt.cpp:954

Expression: !"No exceptions should be raised by this code"

SPID: 236

Process ID: 1060

Msg 0, Level 11, State 0, Line 0

A severe error occurred on the current command. The results, if any, should be discarded.

Msg 0, Level 20, State 0, Line 0

A severe error occurred on the current command. The results, if any, should be discarded.

If I run only for the DB I think is causing the problem I get this...

Msg 0, Level 11, State 0, Line 0

A severe error occurred on the current command. The results, if any, should be discarded.

Msg 0, Level 20, State 0, Line 0

A severe error occurred on the current command. The results, if any, should be discarded.

Well, since this created a dump I guess I'll be contacting product support services. Just thought I'd check online first.|||

I think when system code claims: Expression: !"No exceptions should be raised by this code" that would be the best thing...

Can you post here and tell us what the issue was?

|||Unfortunately, this is an internal server error due to unknown cause, and unlikely to get resolved with standard mini dump only.|||

This is was found to be a bug in SP1 of SQL 2005. The work around is to use limited instead of detailed. I don't get all the data I was wanting to collect but this will work ok until SP2 is released with the fix. We had three DBs on our 2005 server that would generate this error.

|||Thanks for letting us know. It is always interesting when someone else is having a similar problem if a resolution (or lack thereof :) is noted!

Error from sys.dm_db_index_physical_stats "No exceptions should be raised by this code&

I'm setting up a routine to do some reindexing. To get the info I need I'm trying to use the new function. The DB I think is causing the problem does pass DBCC CHECKDB. I'm not sure why I'm getting this but can not find anyone else that is getting this same error.

When I run this....

SELECT *

FROM sys.dm_db_index_physical_stats (NULL, NULL, NULL, NULL, 'detailed')

I get this....

Location: qxcntxt.cpp:954

Expression: !"No exceptions should be raised by this code"

SPID: 236

Process ID: 1060

Msg 0, Level 11, State 0, Line 0

A severe error occurred on the current command. The results, if any, should be discarded.

Msg 0, Level 20, State 0, Line 0

A severe error occurred on the current command. The results, if any, should be discarded.

If I run only for the DB I think is causing the problem I get this...

Msg 0, Level 11, State 0, Line 0

A severe error occurred on the current command. The results, if any, should be discarded.

Msg 0, Level 20, State 0, Line 0

A severe error occurred on the current command. The results, if any, should be discarded.

Well, since this created a dump I guess I'll be contacting product support services. Just thought I'd check online first.|||

I think when system code claims: Expression: !"No exceptions should be raised by this code" that would be the best thing...

Can you post here and tell us what the issue was?

|||Unfortunately, this is an internal server error due to unknown cause, and unlikely to get resolved with standard mini dump only.|||

This is was found to be a bug in SP1 of SQL 2005. The work around is to use limited instead of detailed. I don't get all the data I was wanting to collect but this will work ok until SP2 is released with the fix. We had three DBs on our 2005 server that would generate this error.

|||Thanks for letting us know. It is always interesting when someone else is having a similar problem if a resolution (or lack thereof :) is noted!

error finding in SQL server

hi,

Is there an equivalent function in SQL server as to MYsql's
mysql_error() for easy findings of SQL errors? Couldn't find it in the
manual... If no : What if the recommended action to take?

My SQL statement DIE's when I use it on my php page, but works fine in
the MS SQL query analyzer.

obscurrObscurr (obscurr@.hotmail.com) writes:
> Is there an equivalent function in SQL server as to MYsql's
> mysql_error() for easy findings of SQL errors? Couldn't find it in the
> manual... If no : What if the recommended action to take?
> My SQL statement DIE's when I use it on my php page, but works fine in
> the MS SQL query analyzer.

Since I don't know PHP and I don't know MySQL, I may not be giving
you the right answer.

In general, SQL Server's error handling is fairly poor, and you are
supposed to check @.@.error in your SQL code, and always have the
client code to cover up for you. If your SQL statement fails when
running it from PHP, you probably need to find out how to catch
the error in PHP.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp

Error executing User Defined function on another server

Hi All,
Facing a problem while executing a user defined function (UDF) which resides
on another sql server ( we have access on this sql server to execute the
UDF). This UDF accepts a varchar parameter with max length 8. When we
execute the function as
Select * from
SERVERNAME.DBName.dbo. fn_GetConsulteesDataForReport('00118179'
) it throws an
error as given below.
Server: Msg 170, Level 15, State 31, Line 1
Line 2: Incorrect syntax near '('.
Please let me know what is the issue in my SQL statement and how we can
resolve this.
Thanks in advance.
SuhasThere's a workaround for this hm... feature. Use the OPENQUERY function:
select *
from openquery(SERVERNAME, '
select *
from
DBName.dbo. fn_GetConsulteesDataForReport('00118179'
)
')
ML
http://milambda.blogspot.com/|||Hi ML,
Thank you for giving this suggestion. But please let me know whether open
query does accept variable as an input to the function ? I mean, can I
execute the same as given below.
declare @.empid varchar(8)
select @.empid = '00118179'
select *
from openquery(SERVERNAME, '
select *
from
DBName.dbo.fn_GetConsulteesDataForReport(@.empid)
')
Becuase we need to dynamically change this employee ID.
Thank you.
Suhas
"ML" wrote:

> There's a workaround for this hm... feature. Use the OPENQUERY function:
> select *
> from openquery(SERVERNAME, '
> select *
> from
> DBName.dbo. fn_GetConsulteesDataForReport('00118179'
)
> ')
>
> ML
> --
> http://milambda.blogspot.com/|||For actual production use I'd suggest designing a local UDF, that references
tables in the database on the linked server. This way you can call the
function directly, and still access the data remotely.
ML
http://milambda.blogspot.com/|||Sorry, I forgot to mention, that OPENQUERY does not accept parameters or
variables. Read more here:
http://msdn.microsoft.com/library/d...br />
5xix.asp
ML
http://milambda.blogspot.com/

Wednesday, March 21, 2012

error creating mdf - Connection to SQL server files (*.mdf) require SQL express 2005 to...

Connection to SQL server files (*.mdf) require SQL express 2005 to function properly. please verify the installation of the component or download fromhttp://go.microsoft.com/fwlink/?linkid=49251

I AM GOING TO RIP MY HAIR OUT WITH THIS PROBLEM. I have reinstalled both sql server express 2005 and VWD about 5 times with the same problem. please, please, please someone throw me a bone here and help me resolve this problem.

When I create a new EMPTY website and I rightclick on my website in the solution explorer and choose add item, I chooe SQL Database, I give it a name 'database.mdf' and click add. I get the following message:

you are attempting to add a database to an asp.net application. for a database to be gfenerally consumable in your site, it should be placed inside the 'app_data' folder. would you like to place the database inside the 'app_data' folder? I click YES (I know this message is normal)

then I get the following message:

Connection to SQL server files (*.mdf) require SQL express 2005 to function properly. please verify the installation of the component or download fromhttp://go.microsoft.com/fwlink/?linkid=49251

I can add anything else but this damn mdf file.

thanks for all your help in advance.

FYI to anyone who has had this problem and cannot find a resolution. I have found the solution in a another forum:

From:Brian Piesik -view profileDate:Mon, Feb 13 2006 3:20 pmEmail:Brian Piesik <bpie...@.community.nospam>Groups:microsoft.public.dotnet.framework.windowsforms

Not yet rated

Rating: show options


Reply to Author |Forward |Print |Individual Message |Show original |Report Abuse |Find messages by this author

Thanks Jeffrey, the problem turned out to be a problem in Visual Studio
with an incorrect setting.

What I did was go into Tools, Options, Database Tools, Data Connections.

UnderSQLServer Instance Name (blank for default) i had the following
in there: MyComputerName\SQLEXPRESS

I changed it to the following: SQLEXPRESS

I also tested it just leaving it blank and working too.

Of course I would love to say a favorite end user quote "I never changed
it", but I'm too geeky to know that.

Happy Coding!

Brian Piesik

|||

Thanksbigdbingo, for this valuable post

Monday, March 19, 2012

Error Creating Function

I want to calculate a string, so I have created this Function, but its
giving error any idea please ?
Best Regards,
Luqman
Create function eval
(@.Mycalcstring varchar(50))
returns decimal(12,2)
as
begin
declare @.myString varchar(50)
select @.mystring=exec('select '+@.Mycalcstring)
return(@.myString)
endHi
I am not sure why you don't use cast/convert directly, although this would
depend on the quality of what you are passing to the function.
Create function eval (@.Mycalcstring varchar(50))
returns decimal(12,2)
as
begin
return(CAST(@.Mycalcstring AS decimal(12,2)))
end
SELECT dbo.eval('12.2')
John
"Luqman" wrote:

> I want to calculate a string, so I have created this Function, but its
> giving error any idea please ?
> Best Regards,
> Luqman
> Create function eval
> (@.Mycalcstring varchar(50))
> returns decimal(12,2)
> as
> begin
> declare @.myString varchar(50)
> select @.mystring=exec('select '+@.Mycalcstring)
> return(@.myString)
> end
>
>|||Say, I want to calculate this string : '(10-5)*7/2'
select cast('(10-5)*7/2' AS decimal(12,2))
will give error :
Error converting data type varchar to numeric.
But if I use:
Select (10-5)*7/2 ' It will return 17 which is Correct Result.
So, please advise whats wrong with my function.
Best Regards,
Luqman
"John Bell" <JohnBell@.discussions.microsoft.com> wrote in message
news:CD3C2647-4BAF-4499-A6B9-06D275405010@.microsoft.com...
> Hi
> I am not sure why you don't use cast/convert directly, although this would
> depend on the quality of what you are passing to the function.
> Create function eval (@.Mycalcstring varchar(50))
> returns decimal(12,2)
> as
> begin
> return(CAST(@.Mycalcstring AS decimal(12,2)))
> end
> SELECT dbo.eval('12.2')
> John
> "Luqman" wrote:
>|||Luqman wrote:
> Say, I want to calculate this string : '(10-5)*7/2'
> select cast('(10-5)*7/2' AS decimal(12,2))
> will give error :
> Error converting data type varchar to numeric.
> But if I use:
> Select (10-5)*7/2 ' It will return 17 which is Correct Result.
> So, please advise whats wrong with my function.
> Best Regards,
> Luqman
Dont use the ' because they indicate a character column.
SELECT CAST(((10-5)*7/2) AS DECIMAL(12,2))|||Such calculations are stored in a Table with Varchar Type, so I need to
calculate their values, and as such I need this function.
Following lines will work, but how can I put the select result in Variable.
declare @.myString as varchar(50)
declare @.myValue as Decimal(12,2)
set @.myString='(10-5)/2'
exec ('select ' + @.myvalue) 'This works
set @.myValue=exec ('select ' + @.myvalue) 'This does not work
Best Regards,
Luqman
"Jo Segers" <jo.segers@.alro.be> wrote in message
news:eo04ybPDFHA.512@.TK2MSFTNGP15.phx.gbl...
> Luqman wrote:
> Dont use the ' because they indicate a character column.
> SELECT CAST(((10-5)*7/2) AS DECIMAL(12,2))|||declare @.myString as nvarchar(50)
declare @.myValue as decimal(15,2)
set @.myString='(10-5)/2'
set @.myString = 'select @.myValue = ' + @.myString
exec sp_executesql @.myString, N'@.myValue decimal(15,2) out',@.myValue out
print @.myValue
hth,
Av.
http://dotnetjunkies.com/WebLog/avnrao
http://www28.brinkster.com/avdotnet
"Luqman" <pearlsoft@.cyber.net.pk> wrote in message
news:uH2gmyPDFHA.1296@.TK2MSFTNGP10.phx.gbl...
> Such calculations are stored in a Table with Varchar Type, so I need to
> calculate their values, and as such I need this function.
> Following lines will work, but how can I put the select result in
Variable.
> declare @.myString as varchar(50)
> declare @.myValue as Decimal(12,2)
> set @.myString='(10-5)/2'
> exec ('select ' + @.myvalue) 'This works
> set @.myValue=exec ('select ' + @.myvalue) 'This does not work
> Best Regards,
> Luqman
>
>
> "Jo Segers" <jo.segers@.alro.be> wrote in message
> news:eo04ybPDFHA.512@.TK2MSFTNGP15.phx.gbl...
>|||avnrao wrote:
> declare @.myString as nvarchar(50)
> declare @.myValue as decimal(15,2)
> set @.myString='(10-5)/2'
> set @.myString = 'select @.myValue = ' + @.myString
> exec sp_executesql @.myString, N'@.myValue decimal(15,2) out',@.myValue out
> print @.myValue
> hth,
>
Or if you realy want your 2 decimals:
declare @.myString as nvarchar(50)
declare @.myValue as decimal(15,2)
set @.myString='(10-5)/2'
set @.myString = 'select @.myValue = 1.0*' + @.myString
exec sp_executesql @.myString, N'@.myValue decimal(15,2) out',@.myValue out
print @.myValue|||Hi,
I have created following function in master database and when select it with
:
Select dbo.eval('10-5')
Error occured:
Server: Msg 557, Level 16, State 2, Procedure eval, Line 9
Only functions and extended stored procedures can be executed from within a
function.
Any idea please?
create function eval
(@.myString as varchar(50))
returns decimal(12,2)
as
begin
declare @.myValue as decimal(15,2)
set @.myString='(10-5)/2'
set @.myString = 'select @.myValue = ' + @.myString
exec sp_executesql @.myString, N'@.myValue decimal(15,2) out',@.myValue out
return(@.myValue)
end
"avnrao" <avn@.newsgroups.com> wrote in message
news:u8v6gEQDFHA.2568@.TK2MSFTNGP10.phx.gbl...
> declare @.myString as nvarchar(50)
> declare @.myValue as decimal(15,2)
> set @.myString='(10-5)/2'
> set @.myString = 'select @.myValue = ' + @.myString
> exec sp_executesql @.myString, N'@.myValue decimal(15,2) out',@.myValue out
> print @.myValue
> hth,
> --
> Av.
> http://dotnetjunkies.com/WebLog/avnrao
> http://www28.brinkster.com/avdotnet
>
> "Luqman" <pearlsoft@.cyber.net.pk> wrote in message
> news:uH2gmyPDFHA.1296@.TK2MSFTNGP10.phx.gbl...
> Variable.
>|||You cannot run dynamic SQL from within a function. EXEC and
sp_executesql are not allowed. Either use an SP or, better still IMO,
do it in some external code. I don't understand why you would want to
do this in a database.
Also, I wouldn't recommend putting functions or other objects in Master
on a production system.
David Portas
SQL Server MVP
--|||Hi,
I just want to create a function which should calculate a String, and return
the result, someone recommended this way ?
If you have better solution, please adv.
Best Regards,
Luqman
"David Portas" <REMOVE_BEFORE_REPLYING_dportas@.acm.org> wrote in message
news:1107775757.602219.248630@.o13g2000cwo.googlegroups.com...
> You cannot run dynamic SQL from within a function. EXEC and
> sp_executesql are not allowed. Either use an SP or, better still IMO,
> do it in some external code. I don't understand why you would want to
> do this in a database.
> Also, I wouldn't recommend putting functions or other objects in Master
> on a production system.
> --
> David Portas
> SQL Server MVP
> --
>

Friday, March 9, 2012

Error Connection pooling ODBC - SQLConnect where Database this down

My application works with the Connection pooling ODBC. Everything works well, when it data base this down the SQLConnect function finishes steeply my application.

Sorry that I don't completely understand your scenario. Can you describe more clearly? Or can you post a short repro?

Thanks,

Junfeng

|||Database: MySql, Programming Language: C++

My application uses ODBC connection pooling, now when the database is operational everything works out fine, but as
soon as I stop it the SQLConnect function doesn't return the error but kills abruptly the application.

I've solved the problem... I've found it to be a bug in the MySql ODBC driver, I was working with version 3.51.10, when
I switched to 3.51.14 the problem dissapeared.

Thanks...