I am working on a task converting netezza to snowflake. So i need a solution to convert netezza create function to snowflake create function.
Netezza user defined functions are implemented in C++ and Snowflake user defined functions are in either SQL or Javascript, so a conversion isn't possible. You will have to reimplement the function in Javascript or SQL.
Related
I know Snowflake by default encrypts data at rest. But I wanted to know if there is a built-in feature to encrypt a column value and store it in Snowflake tables. Or is it something that I need to code using snowpark and store as a procedure.
I would recommend that you read up on the Dynamic Data Masking that is available natively in Snowflake, which allows you to encrypt data to specific roles or all roles, as needed. And if there in an external encryption tool via API that you'd like to use, Dynamic Data Masking can leverage that API via an External Function. You shouldn't need Snowpark or a Stored Procedure to accomplish this.
https://docs.snowflake.com/en/user-guide/security-column-ddm.html
We have an External function defined in Snowflake. I want to call that function in my JavaScript UDF function. Is it possible to do so?
Thanks
Currently, you can't call any other UDF including external functions from a JavaScript UDF. You can call them from SQL UDFs and JavaScript stored procedures by executing them in a SQL statement.
You can also nest UDF calls, like select function_1(function_2(my_value));
I am just wondering which will be faster t-sql function/procedure or clr version of one? A procedure works with database data and use cursors (t-sql version).
When should I use clr and when I should use t-sql to create procedures and functions?
Simple rule-of-thumb:
data manipulation (SELECT, UPDATE etc.) are best left to T-SQL (but without cursors!)
while anything that has to do with processing (string/regex matching, date arithmetic, calling external web services etc.) is a good match for SQL-CLR
I am planning on deploying a database to SQL Azure, so I cannot use the SQL CLR. However, I have a need to create an aggregate function -- in my case, I need to STUnion a bunch of Geography objects together. (Azure is expected to support Spatial by June.)
Is there another way to accomplish this, without making use of the CLR, in a query? Or do I have to create a UDF that will take a table as a parameter and return the aggregate?
You can't do it.
Geography is supported in Azure SQL now.
https://msdn.microsoft.com/en-us/library/cc280766.aspx
Is there some way to pass a table-valued parameter to a stored procedure in SQL Server via classic ADO?
Classic ADO is COM and OLE and the SQL Native Client supports Table Valued Parameters over OleDB, see Table-Valued Parameters (OLE DB). One would have to get its hand dirty and code straight to the OleDB interfaces (in C/C++).
Also TVPs are only in SQL 2008, so you won't be able to use them in SQL 2005.
BTW, for completness here is the Table Valued Parameters (ODBC) reference, for the ODBC nostalgics out there...
I thought they were new in 2008?
Anyway, I think the answer is going to be no, I doubt there's a DataTypeEnum value that you'll be able to bend to your needs.
So if I may suggest an alternative, I guess what you want to do is pass some sort of structured data into the stored procedure. I have done this before in ADO using XML:
define the parameter in the stored proc as type xml
define the parameter in ADO as type adLongVarChar with a length = len(xml) + 1
I know it's not what you wanted, but it's a method that works