user-defined-functions

How to call an extended procedure from a function

陌路散爱 提交于 2020-01-05 13:31:25
问题 hi im having trouble trying to get the following function to work. CREATE FUNCTION test ( @nt_group VARCHAR(128) ) RETURNS @nt_usr TABLE ( [name] [nchar](128) NULL , [type] [char](8) NULL , [privilege] [char](9) NULL , [mapped login name] [nchar](128) NULL , [permission path] [nchar](128) NULL ) AS BEGIN INSERT INTO @nt_usr EXEC master.dbo.xp_logininfo 'DOMAIN\USER', @nt_group RETURN END As far as i know i should be allowed to call an extended stored procedure, im getting the following error

How to call an extended procedure from a function

旧时模样 提交于 2020-01-05 13:31:08
问题 hi im having trouble trying to get the following function to work. CREATE FUNCTION test ( @nt_group VARCHAR(128) ) RETURNS @nt_usr TABLE ( [name] [nchar](128) NULL , [type] [char](8) NULL , [privilege] [char](9) NULL , [mapped login name] [nchar](128) NULL , [permission path] [nchar](128) NULL ) AS BEGIN INSERT INTO @nt_usr EXEC master.dbo.xp_logininfo 'DOMAIN\USER', @nt_group RETURN END As far as i know i should be allowed to call an extended stored procedure, im getting the following error

How to register UDF/RTD within VSTO project

折月煮酒 提交于 2020-01-04 14:13:51
问题 All, This is a follow up for my question here. My setup: Visual Studio 10 Language C# Excel 2007+ Windows XP+ What I would like to achieve is this: Create VSTO addin for Excel with a custom Ribbon component and a custom Task Pane Create an RTD server Create some UDF's that wrap the =RTD() -calls for the Excel users Have the clients install the Addin through a ClickOnce installation Apart from the last requirement, I am basically done. The only problem I have is to get the RTD server and the

SQL Server 2008: Can a multi-statement UDF return a UDT? [duplicate]

谁说胖子不能爱 提交于 2020-01-04 05:46:29
问题 This question already has answers here : SQL Server 2008 - How do i return a User-Defined Table Type from a Table-Valued Function? (4 answers) Closed 4 years ago . Is it possible that a multi-statement UDF return a User Defined Table Type, instead of a table that is defined within it's return param? So instead of: CREATE FUNCTION MyFunc ( @p1 int, @p2 char ) RETURNS @SomeVar TABLE ( c1 int ) AS I would like to do: CREATE FUNCTION MyFunc ( @p1 int, @p2 char ) RETURNS @SomeVar MyTableType AS

python pandas- AttributeError: 'Series' object has no attribute 'columns'?

懵懂的女人 提交于 2020-01-03 17:27:06
问题 I am trying to count the number of times the current row's value for a specific column 'df1' falls between the low-high range values in the previous 5 rows (in 2 side by side columns). This is a follow-up question - Dickster has already done the heavy lifting here. The Series().between() method is not cooperating, complaining that AttributeError: 'Series' object has no attribute 'columns' . I don't understand how I am involving the columns attribute. list1 = [[21,101],[22,110],[25,113],[24

Is there any way to make this UDF deterministic?

风格不统一 提交于 2020-01-03 17:13:23
问题 I assume this is not deterministic simply because DB_NAME() is not deterministic? If DB_NAME() is not deterministic, why is it not deterministic? ALTER FUNCTION [TheSchema].[udf_IS_PRODUCTION] () RETURNS bit WITH SCHEMABINDING AS BEGIN RETURN CASE WHEN DB_NAME() = 'PRODUCTION' THEN CONVERT(bit, 1) ELSE CONVERT(bit, 0) END END Update: This version works, is deterministic, allows the same code to be used in any database and removes the hardcoding of the database name (which also allows me to

Weird error in udf when included in “WHERE…IN” clause

拈花ヽ惹草 提交于 2020-01-03 13:37:56
问题 I have a function that splits up a string (pasted at the end for clarity). This function works as expected when used alone. Example: SELECT value FROM dbo.mg_fn_Split('2#1','#') Returns -- value -- -- 2 -- -- 1 -- ----------- But when used in a "WHERE IN" clause, as in this example (more on tableA later on): SELECT * FROM TableA WHERE TableA.id IN ( SELECT value FROM dbo.mg_fn_Split('2#1','#') ) I get the error: "Invalid length parameter passed to the LEFT or SUBSTRING function." TableA is

Can I use JS BigInt in a BigQuery UDF?

旧街凉风 提交于 2020-01-03 05:47:27
问题 Chrome V8 - the JavaScript engine - recently added support for BigInt - arbitrary precision large integers: https://developers.google.com/web/updates/2018/05/bigint Can I use these BigInt in BigQuery? 回答1: Yes! BigQuery runs one of the latest versions of V8, so it already supports BigInts. To use them: CREATE TEMP FUNCTION testBigInt() RETURNS ARRAY<STRING> LANGUAGE js AS """ return [ Number.MAX_SAFE_INTEGER , Number.MAX_SAFE_INTEGER+2 , Number.MAX_SAFE_INTEGER+1 , Number.MAX_SAFE_INTEGER+100

Pig error 1070 when doing UDF

做~自己de王妃 提交于 2020-01-03 05:09:05
问题 I am trying to load up my own UDF in pig. I have made it into a jar using eclipse's export function. I am trying to run it locally so I can make sure it works before I put the jar on HDFS. When running it locally, I get the following error: ERROR 1070: Could not resolve myudfs.MONTH using imports: [, org.apache.pig.builtin., org.apache.pig.impl.builtin.] Script REGISTER myudfs.jar; --DEFINE MONTH myudfs.MONTH; A = load 'access_log_Jul95' using PigStorage(' ') as (ip:chararray, dash1:chararray

MySQL User Defined Function to send a windows message

ε祈祈猫儿з 提交于 2020-01-03 04:18:27
问题 G'Day, I want to use the Windows API Postmessage() call from inside a MySQL UDF on MySQL 5.1.51 (XP SP3). I know the UDF (Written in Delphi 2006) is working by setting a bogus result for the UDF. The syntax of the UDF takes two integer params, one for a window handle and the other for a message number. However a call to PostMessage() from inside my UDF causes an exception in mysqld and the service stops. Any ideas or pointers? Alternatively if anyone can tell me how I am able to simulate IB