I am getting a fatal error on following code.
exec [sp_ExternalApp_UPDATEUSER] 'ZZZ', XXXXX','DDDDD','DDDFFDD','EREE', 'EREWWWWW',1,1,'QWEW#DFEE.DER','DEFF','XXXX','DDDD'
Following error occurred:
Location: memilb.cpp:1624
Expression: pilb->m_cRef == 0
SPID: 79
Process ID: 2256
Msg 3624, Level 20, State 1, Procedure sp_ExternalApp_UPDATEUSER, Line 32
A system assertion check has failed. Check the SQL Server error log for details
Msg 0, Level 20, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
Thank you
I got the solution.
I have used UPPER() function. As I removed that function, my problem solved
Like the message said, check your error log, there might be more detail in there..what does this proc do does it use sp_OACreate or calls xp_cmdshell? Post the proc code
You might want to check the database for corruption. Try
DBCC CHECKDB
(before doing so, read the documentation on that command! See http://msdn.microsoft.com/en-us/library/ms176064.aspx )
Related
I am trying to call a stored procedure from code using .Net Core 3.0 and SQL Server 2012, but I keep getting this error:
SqlException: Incorrect syntax near the keyword 'exec'. Incorrect syntax near ')'.
My code:
var policycontacts = await _dbContext.PolicyContacts
.FromSqlInterpolated($"exec dbo.spapi_contact_getbypolicy {input}")
.FirstOrDefaultAsync()
.ConfigureAwait(false);
SQL code:
EXEC Sp_executesql
N'SELECT TOP(1) [p].[ID], [p].[ActionsToTake],
[p].[AddedBy], [p].[BirthCountry], [p].[ContactGUID],
[p].[ContactID], [p].[ContactStatus], [p].[DOBFormation],
[p].[Domicile], [p].[EnhancedDueDiligence], [p].[EntityName],
[p].[EstimatedAmountAssets], [p].[FirstName], [p].[Gender],
[p].[HowClientMet], [p].[LastModifiedBy], [p].[LastModifiedDate],
[p].[LastName], [p].[LastOpenDate], [p].[LastOpenedBy],
[p].[MiddleName], [p].[Notes], [p].[OccupationBusiness],
[p].[OnlineUser], [p].[OpeningNotes], [p].[OriginAssets],
[p].[PEP], [p].[PEPDescription], [p].[PersonalSituation],
[p].[RiskOverride], [p].[Sysdate] FROM (exec dbo.spapi_contact_getbypolicy #p0)AS [p]',
N'#p0 nvarchar(4000)',
#p0=N''
Complete error:
Msg 156, Level 15, State 1, Line 3
Incorrect syntax near the keyword 'exec'
Msg 102, Level 15, State 1, Line 4
Incorrect syntax near ')'
Not enough rep to leave a comment, so I have to leave you an answer. Sorry, I think this is more of a comment.
I have a "okay" recommendation, but it might not be the best answer. Depending on how complex your stored procedure is and if you really want to call it in the FROM section, then change your stored procedure into a table valued function. The reason why its a terrible recommendation is there are limitations and performance issues by using a function. I'd read up on the following articles and see which route you would like to take.
Table Valued Function Killing My Query Performance
https://blogs.msdn.microsoft.com/psssql/2010/10/28/query-performance-and-multi-statement-table-valued-functions/
Cross Apply with table valued function article:
https://www.sqlshack.com/the-difference-between-cross-apply-and-outer-apply-in-sql-server/
The other option could be the one where Sean Lange provided.
I started to explore R on SQL 2016 but running into errors. I resolved a few starting errors but can't get through with this one:
exec sp_execute_external_script
#language =N'R',
#script=N'OutputDataSet<-InputDataSet',
#input_data_1 =N'select 1 as hello'
with result sets (([hello] int not null));
go
Error:
Msg 39021, Level 16, State 1, Line 1
Unable to launch runtime for 'R' script. Please check the configuration of the 'R' runtime.
Msg 39019, Level 16, State 1, Line 1
An external script error occurred:
Unable to launch the runtime. ErrorCode 0x80070490: 1168(Element not found.).
Msg 11536, Level 16, State 1, Line 1
EXECUTE statement failed because its WITH RESULT SETS clause specified 1 result set(s), but the statement only sent 0 result set(s) at run time.
I found answers to set the Working Directory for R in Rlauncher.config.
But there is no Rlauncher.config on below path on my machine. Not Sure why?
C:\Program Files\Microsoft SQL Server 2016\MSSQL13.SQL2016\MSSQL\Binn
When I check the error log I see the following errors:
2016-11-13 19:41:14.131 Security Context Manager is initialized successfully.
2016-11-13 19:41:14.132 Satellite Session Manager is initialized successfully.
2016-11-13 19:41:14.133 Launcher DLL RLauncher.dll not loaded! Error: 126
2016-11-13 19:41:14.133 Failed to load the launcher RLauncher.dll and check satellite version
2016-11-13 19:41:14.133 No Launcher dlls were registered!
Please help.
Please make sure you have installed the R Services (In-Database) in the SQL Setup Feature selection page. Please note this is different from the R Server option. See here for details.
I'm having an issue on settin up SqlException.Number
On my Stored Proc i'm raising an error
--#number = 50001
RAISERROR(#number, 16, 1) -
I should expect that the Error_Number() should be #number but I always get 18054
Is there something wrong with my RAISERROR?
Check the sys.messages table for error code 74601. if this is a user defined error, it shouold be added in the table.
for any error that is greater than 50000 should give you this output if not found.
Msg 18054, Level 16, State 1, Line 1
Error XXXXX, severity 16, state 1 was raised, but no message with that error number was found in sys.messages. If error is larger than 50000, make sure the user-defined message is added using sp_addmessage.
There is one small caveat: You can't supply a message on your own in this case. But this can be circumvented by adding an additional %s in the sp_addmessage call or by changing all mapped messages to your own pattern and supplying the right parameters in the raiseerror call.
Check there for more information:
SQL Server: Rethrow exception with the original exception number
RAISERROR can either reference a user-defined message stored in the
sys.messages catalog view or build a message dynamically.
Check for your error message exists or not using this:
select * from sys.messages
If it does not exists then Use sp_addmessage to add user-defined error messages and sp_dropmessage to delete user-defined error messages.
for more information follow RaiseError documentation.
When I run something like
BACKUP LOG [somedb]
TO DISK = N'i:\log.bak';
It throws 2 errors messages:
Msg 3201, Level 16, State 1, Line 2
Cannot open backup device 'i:\log.bak'. Operating system error 3(The system cannot find the path specified.).
Msg 3013, Level 16, State 1, Line 2
BACKUP LOG is terminating abnormally.
When I try to handle the error with a TRY CATCH the error returned is always 3013. This is a problem for me because I want to know if the backup failed due to lack of space, or if the drive isn't present, etc.
Using ##ERROR returns the same error number.
Is there any way to handle multiple error messages like these?
You need to inspect the Errors collection inside the SqlException:
catch(SqlException sqlEx)
{
foreach(SqlError error in sqlEx.Errors)
{
int code = error.Number;
string msg = error.Message;
}
}
You should get all error with all relevant details in the SqlException.Errors
Hello A client of mine has had an HD crash an a SQL DB got corrupt :
They did not make backups so they have a big problem.
When I tried (an ultimate measure) to DBCC-repair I got the following message.
Can anybody help me with this ?
Server: Msg 8966, Level 16, State 1, Line 1
Could not read and latch page (1:872) with latch type SH. sysindexes failed.
Server: Msg 8944, Level 16, State 1, Line 1
Table error: Object ID 2, index ID 0, page (1:872), row 11. Test (columnOffsets->IsComplex (varColumnNumber) && (ColumnId == COLID_HYDRA_TEXTPTR || ColumnId == COLID_INROW_ROOT || ColumnId == COLID_BACKPTR)) failed. Values are 2 and 5.
The repair level on the DBCC statement caused this repair to be bypassed.
CHECKTABLE found 0 allocation errors and 1 consistency errors in table 'sysindexes' (object ID 2).
DBCC execution completed. If DBCC printed error messages, contact your system administrator.
Paul Randal's blog has a really good article on CHECKDB.
http://www.sqlskills.com/BLOGS/PAUL/category/CHECKDB-From-Every-Angle.aspx