October 23, 2014 at 8:30 pm
Comments posted to this topic are about the item Template parameters
October 24, 2014 at 12:31 am
I never use those. Great question though.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
October 24, 2014 at 3:14 am
This was removed by the editor as SPAM
October 24, 2014 at 5:23 am
I've created several templates for my own use and find them to be great time-savers. They're good for standardized processes you run that involves multiple steps where you just change out a few parameters, but the task isn't run frequently enough to rise to the level of a stored procedure. They're another good tool to have in the toolbox.
October 24, 2014 at 5:25 am
I have never heard of templates so I pulled found out how to access them and pulled up the first one for aggregates. Here is the part from the create:
CREATE AGGREGATE <aggregate_name, sysname, sample_aggregate>(@<parameter_name, sysname, parameter1> <parameter_type, sysname, nvarchar(4000)>)
RETURNS <return_type, sysname, nvarchar(4000)>
EXTERNAL NAME <assembly_name, sysname, sample_assembly>.<clr_type_name, sysname, sample_clr_name>
GO
To me this says that the data type is the last item in the list so I picked that. Seems like there is some inconsistency in how the parameters are done.
October 24, 2014 at 7:18 am
I think I would have put this one under a different category. I don't know what this has to do with T-SQL. I still managed to get it right though.
Tony
------------------------------------
Are you suggesting coconuts migrate?
October 24, 2014 at 7:37 am
I wasn't 100% sure but, <name, type, default> seemed logical since that is the way variables/parameters are declared. Nice question.
Aigle de Guerre!
October 24, 2014 at 7:43 am
Thanks for the question. Good one to end the week on.
October 24, 2014 at 8:44 am
Meow Now (10/24/2014)
I wasn't 100% sure but, <name, type, default> seemed logical since that is the way variables/parameters are declared. Nice question.
That was my thinking, too. Thanks, Steve. Enjoy London!
October 24, 2014 at 9:56 am
Thank you for the post, Steve, interesting one.
I used this before and i have created my own templates for some set of specific work which i use them.
ww; Raghu
--
The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.
October 24, 2014 at 11:31 am
tom.w.brannon (10/24/2014)
I have never heard of templates so I pulled found out how to access them and pulled up the first one for aggregates. Here is the part from the create:CREATE AGGREGATE <aggregate_name, sysname, sample_aggregate>(@<parameter_name, sysname, parameter1> <parameter_type, sysname, nvarchar(4000)>)
RETURNS <return_type, sysname, nvarchar(4000)>
EXTERNAL NAME <assembly_name, sysname, sample_assembly>.<clr_type_name, sysname, sample_clr_name>
GO
To me this says that the data type is the last item in the list so I picked that. Seems like there is some inconsistency in how the parameters are done.
You were unlucky with the selection of the template you picked, and the parameter you looked at.
<return_type, sysname, nvarchar(4000)>
The template is for a function (Aggregate is a specific type of function). This place is where the data type of the returned value is specified. The name of this parameter is "return_type", and the data type is "sysname" (a specific datatype for builtin names, an alias for I think nvarchar(128).) The third value here is the default: "nvarchar(4000)" - this looks like a data type because it is used in a template in a place where you have to specify a data type.
If you had looked at the "aggregate_name" parameter, or if you had used e.g. a template for SELECT (if that exists), you would not have had this confusion.
Like I said - unlucky.
October 24, 2014 at 11:46 am
Thanks for the easy question.
I haven't used templates since the good old ones we had back in Sql 2000.
---------------
Mel. 😎
October 24, 2014 at 11:50 am
Thanks for the explanation Hugo. At least I was trying to think the right way.
October 25, 2014 at 12:38 pm
Nice one, thanks for spotting it.
Iulian
October 26, 2014 at 12:56 am
stephen.long.1 (10/24/2014)
Meow Now (10/24/2014)
I wasn't 100% sure but, <name, type, default> seemed logical since that is the way variables/parameters are declared. Nice question.That was my thinking, too. Thanks, Steve. Enjoy London!
+1, Never used this tool before, but that was a pretty logic thinking enough.
Thanks & Best Regards,
Hany Helmy
SQL Server Database Consultant
Viewing 15 posts - 1 through 15 (of 19 total)
You must be logged in to reply to this topic. Login to reply