General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
Environment versions
OS:
Windows Server 2012 R2
Network:
Windows Server 2012 R2
Virtual environment:
VMWare
Ok if I understand you, besides the language example that Dorris showed, you can write a stored procedure in another language (e.g. C# as you mentioned below) and then somehow "attach" this to the database and so when you call the function, the database is able to run the C# routine and return some value or table etc. Do I understand this correctly?
Thanks,
Albert
>>Kinda a random question but it has crossed my mind as I have worked through the many posts - what are stored procedures written in when they are contained within SQL Server or PostgreSQL server? I would assume it is some sort of function call that runs some sort of script?
>>
>>Albert
>
>Let's separate it to MS SQL Server and postgreSQL,
>
>MS SQL Server: Mostly written in T-SQL (SQL that MS SQL use). But also you could use a .Net (probably C#) language to write an SP (Stored Procedure), UDF (User Defined Function), UDT (User Defined Type), Triggers. When you do that, ie: write a UDF in C#, and register with your database, then that function become part of your database as if it were a built-in function (ie: I have some of them which one is only about parsing a comma separated value list to a single column table for passing multiple IDs as a single string. The same thing as a T-SQL procedure was timing out when thousands of IDs were passed. With the CLR version even 10+K IDs is processed in milliseconds).
>Note: SP and Function are similar with some differences. Don't overlook Functions (that returns table - aka TVF).
>
>postgreSQL: The default language is pgSQL, Comparing T-SQL and pgSQL is .... hmm no need to get blames, you can see it yourself checking a few T-SQL and pgSQL codes. Also postgreSQL supports them to be written in other languages, the ones I know off the top of my head are V8 Javascript, Python, C, Go (and I love that ability). Unlike MS SQL CLR, which is similarly supporting a .Net language is not as easy as this one.
Previous
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only