TVF_SubscriptionFileName

The list of table valued functions used by Guildford College Reports and any anyone else wishes to share
Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
User avatar
robinwilson16
Site Admin
Posts: 185
Joined: Sun Oct 16, 2016 6:46 pm
Forename: Robin
Surname: Wilson
College Name: FEA
Position: MIS Consultant
LinkedIn Profile: https://www.linkedin.com/in/robinwilson16
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

TVF_SubscriptionFileName

Post by robinwilson16 » Fri Mar 03, 2017 12:00 am

Used for generating file paths for SSRS report subscriptions removing all the characters that are not allowed in file paths

Code: Select all

CREATE FUNCTION [dbo].[TVF_SubscriptionFileName]
(
	@String NVARCHAR(MAX)
)
RETURNS TABLE
AS
RETURN 
	--DECLARE @String NVARCHAR(MAX) = 'First & Second/3rd'

	SELECT
		Value = 
			REPLACE ( 
				REPLACE ( 
					REPLACE ( 
						REPLACE ( 
							REPLACE ( 
								REPLACE ( 
									REPLACE ( 
										REPLACE ( 
											REPLACE ( 
												REPLACE ( 
													REPLACE ( 
														REPLACE ( 
															REPLACE ( 
																REPLACE ( 
																	@String, 
																'&', '' ),
															'"', '' ),
														']', '' ),
													'[', '' ),
												',', '' ),
											'+', '' ),
										'|', '' ),
									'>', '' ),
								'<', '' ),
							':', '' ),
						'*', '' ),
					'?', '' ),
				'\', '' ),
			'/', '' )

Post Reply [phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable
[phpBB Debug] PHP Warning: in file [ROOT]/vendor/twig/twig/lib/Twig/Extension/Core.php on line 1266: count(): Parameter must be an array or an object that implements Countable

Who is online

Users browsing this forum: No registered users and 0 guests