Red Gate forums :: View topic - Params for table value functions causing errors.
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Source Control EAP
SQL Source Control EAP forum

Params for table value functions causing errors.

Search in SQL Source Control EAP forum
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.
Jump to:  
Author Message
jonmor



Joined: 16 Jun 2010
Posts: 2

PostPosted: Wed Jun 16, 2010 3:19 pm    Post subject: Params for table value functions causing errors. Reply with quote

Keep getting the message detailed below - this error prevents the entire database from updating to subversion and also incremental changes to the code being made.

Errors occured whilst parsing file C:\Documents and Settings\********\Local Settings\Application Data\Red Gate\SQL Source Control 0\Transients\piohmrkf.sjq\Stored Procedures\dbo.usp_PriceEditor_InjectPermissionChange_PriceEditor.sql

'line 23:47: unexpected token: ["DEFAULT",<656>,line=23,col=47] [char=768]'

'line 23:47: unexpected token: ["DEFAULT",<656>,line=23,col=47] [char=768]'

The code causing the problem is below

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [usp_PriceEditor_InjectPermissionChange_PriceEditor]
(
@Username AS VARCHAR(50),
@Allowed AS BIT
)
AS
/*#################################################################################################
Description: Injects a new User if not presnt and assigns PriceEditorPermissions
Author: *********
Date: 2007-05-08
###################################################################################################*/

IF NOT EXISTS ( SELECT * FROM dbo.udf_UserDetails(@Username))
BEGIN
INSERT INTO dbo.udf_UserDetails(DEFAULT) /*TODO trigger on this as will only update the Users table
Person table would also need update or rows will not be
returned.*/
([sUserName])
VALUES
(@Username)
END

UPDATE dbo.udf_UserDetails(@Username)
SET
[bPermPriceEditor] = @Allowed
Back to top
View user's profile Send private message
sherr



Joined: 19 Mar 2009
Posts: 125
Location: Cambridge

PostPosted: Wed Jun 16, 2010 4:53 pm    Post subject: Params for table value functions causing errors. Reply with quote

Hello,

In order to replicate this issue, could you please post or email support@red-gate.com the script for dbo.udf_UserDetails?

If by email, please reference our internal support number SOC-1197.

Thank you!
Stephanie M. Herr Smile
Project Manager
Back to top
View user's profile Send private message
jonmor



Joined: 16 Jun 2010
Posts: 2

PostPosted: Thu Jun 24, 2010 9:59 am    Post subject: Reply with quote

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- ====================================================
-- Author: ***********
-- Create date: 10/10/2007
-- Description: Returns user details from the Config DB
-- for the passed in UserName or all
-- users if UserName not passed in
-- ====================================================
ALTER FUNCTION [udf_UserDetails]
(
@sUserName varchar(50) = NULL
)
RETURNS TABLE
AS
RETURN
(
SELECT U.sUserName as sUserName,
P.sFirstName as sFName,
P.sLastName as sLName,
P.sEmail as sEMail,
P.sFullName as sFullName,
U.bPermPriceEditor,
U.bAdmin,
U.sFavouritePCode,
U.iUID
FROM dbo.Users U
INNER JOIN dbo.CONFIG_DB_Person P
ON U.sUserName = P.sUserName
WHERE UPPER(U.sUserName) = UPPER(@sUserName)
OR @sUserName IS NULL
)
Back to top
View user's profile Send private message
Display posts from previous:   
This topic is locked: you cannot edit posts or make replies. All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group