SQL Server 2005 Message Localisation - sql-server-2005

I have a bunch of stored procedures which use RAISERROR to return to the client C# application certain business-logic error messages, and now I wonder if there is a way to localize these message in a way similar to .NET. Can these messages be localized somehow, or do they have to be hard-coded in the "main" language being used?
Side question: I have a .NET class library containing a resource file with strings. Can I use this dll from SQL Server 2005 and retrieve these error messages from that resource file?

SQL Server has localisation for the built-in system messages for many languages/locales.
For your own custom messages, you will have to catch and translate them in your application layer.
It 'might' be possible to use your .NET dll from SQL Server 2005 and retrieve these error messages from that resource file using a CLR Stored Procedure, but I wouldn't recommended doing it that way (it has permissions/deployment implications that are frankly best avoided).

Mitch indicated that the built in messages are localized. He didn't mention that you can use the same localization system for your own message. sp_addmessage lets you add new messages (and specify the language).
You then use the version of RAISERROR that uses a message number, rather than a message text.

Related

Is it possible to call a web service from SQL Server?

Is it somehow possible to call a web service from SQL Server without using CLR and get response immediatly back(not powershell, etc..)?
SQL Server provide a lot of different options to execute external scripts or connect to other devices. SQLCLR is one of the best but not the only option
From SQL 2016 you can use R or you can use Python, which let basically do what ever you want if you have permission.
You can use xp_cmdshell to execute commands
You can use OLE Automation objects (here is a nice sample).
You can use auditing tools (not recommended for most of these cases since these run in the background and not only when you need them), which allow you to execute external scripts on event
You can use simple QUEUE in the server side. In the Sp you can simply add message to the QUEUE and using external service app you can execute anything that you want once a new message get to the QUEUE. This option can be very useful since the execution is done asynchronous.
I can probably think about a lot more options... but let's start with these :-)

Retrieve XML Code by API with Automatic Approach

Goal:
Retrieve a XML list from Internet, using API connection, and transfer the data into a sql server's table automatic using Scheduling tool with SQ server agent and its jobs.
Problem:
I have two questions:
What component in SSIS do I need to retrieve the XML file, using API connection?
Is it possible to use stored procedure, code that retrieve and transform the xml file and its data, to transfer it into a table? In This context, no usage of SSIS.
Information:
*The computers version is SQL 2008 R2 standard edition.
If everything is straightforward, I would use Web Service Task. If not, use the Script Task and take care of API Connection in C# code. See this link.
Yes. to avoid SSIS, you need to create a CLR Stored Procedure. See this link.

SSRS 2008 - reportservices.asmx not compatible with legacy app

We have acquired an application that was written approximately 2003. Part of the app uses SQL Server Reporting Services to generate PDFs of reports. Basically within the app a user clicks a button, modifies parameters (start/end date) and a report is passed back (i think) in PDF format so that it can be printed. Great. Works fine in SQL 2005.
However, SQL 2008 is another beast entirely. I can run the same report from the web interface (http://127.0.0.1/reports/...). But the URL doesn't work. I dug around and found that the app is sending a call to 127.0.0.1/reportserver/reportservice.asmx. Now it returns an empty string instead of the XML document.
Supposedly there is a 2005 compatible version called reportserver/reportexecution2005.asmx but that generates a whacky SOAP error. "System.Web.Services.Protocols.SoapException: Server did not recognize the value of HTTP Header SOAPAction: http://schemas.microsoft.com/sqlserver/2003/12/reportingservices/Render. at System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouterRequest() ....
I notice now when I try to use internet explorer and browse to 127.0.0.1/reportserver/reportservice.asmx i get a login prompt, whereas that was not the case with SSRS 2005. I also notice that if I browse to reportserver/reportexecution2005.asmx it returns a XML page which seems mostly similar to what was returned in SSRS 2005.
So obviously I am missing something. I think since the app was created a while ago I should be using the SQL2000 version which is 127.0.0.1/reportserver/reportservice.asmx. But I think now there is an authentication error.
Anyway. I'm clueless. Anyone have any thoughts? Thanks.
We don't have the source code to the app, but I can modify the connection parameters, like I can ask it to query for ReportServiceXXX.asmx instead of ReportService.asmx
You are very close to seeing the problem. If you look closely at the XML from ReportExecution2005.asmx you will see that it is in Soap12. Your error message shows that a call was made using method System.Web.Services.Protocols.Soap11ServerProtocolHelper.RouterRequest, which is sending a Soap11 message. I am having the same problem, but have not solved it yet.
My two options are to either add a binding to SQL 2008 report service to accept Soap11 or modify my code to send Soap12. I am hoping for a simple config change in SQL server, but have not found it yet.

SQL Server CLR Integration to achieve Encryption/Decryption

I have a requirement to store the data in encrypted form in database tables. I want to do it at the database level but here are the problems I am facing:
Data Type of the field should be Varbinary.
Encryption is not supported by Workgroup edition
Is it possible to encrypt Numeric Fields?
I want to access the encrypted data in tables to fetch in views and stored procedure for some processing but due to above problems I am not able to.
Here is my Environment:
Development Platform - ASP.Net,.Net Framework 3.5,Visual studio 2008
Server Operating System - Windows Server 2008
Database - SQL Server 2008 Work group edition
I was also thinking to adopt a different approach to resolve this issue (yet to test it's feasibility). I was just wondering if I could create a CLR function (which could take parameters to encrypt and decrypt data using Cryptography types provided in .Net framework) and use the CLR integration feature of SQL Server and call that function from stored procedure and views.
I am not sure if I am thinking in right direction? Any advice on this as well please.
Yes, you can do that. However, your SQL CLR assembly may need to be marked as unsafe for the crypto classes to work, depending on what cryptoapi methods you use.

Registering Assemblies used In SQL CLR Stored Procedure

I have been messing around with writing some stored procedures in .NET code with SQL CLR Integration. In the stored procedure, I am calling a third-party dll. When I try to create the assembly in SQL Server containing my custom stored proc, it complains that the third-party dll is not registered with the database.
Is there some way I can call the dll without registering it in SQL Server?
No, you can't use an assembly that isn't in the Approved Assembly list, or that isn't registered in the database. You can't even load it into the GAC to access it, it has to explicitly be added to SQL Server using CREATE ASSEMBLY. Why don't you want to load the assembly into the database? What is it doing that you need in SQL? I ask because there may be a different solution to your problem that is a better fit.
The third party assembly must be pre-deployed to the server. Look at this link for instructions on deploying the assembly to the server.