milani_lucie
asked on
CREATE PROC template help needed with simple example - SQL Server 2005 / 2008 !
Hi,
I am new to creating templates in SQL Server 2005. I want to do a simple example on CREATE PROC. Can you please provide me the code ?
BTW: Can you please explain the below syntax ?
SELECT <Columns, sysname, >
I do not have anything after the sysname comma. Can you please explain me the syntax for this ?
Thanks
I am new to creating templates in SQL Server 2005. I want to do a simple example on CREATE PROC. Can you please provide me the code ?
BTW: Can you please explain the below syntax ?
SELECT <Columns, sysname, >
I do not have anything after the sysname comma. Can you please explain me the syntax for this ?
Thanks
ASKER
Creating templates (tql).
Thanks
Thanks
can you post the full query syntax for the SELECT <Columns, sysname, > , or an URL where i can refer
That syntax tells you that you're selecting a list of columns, and that the list is a series of sysname types (a column name is of type sysname). Sometimes there is a style indicator after the second comma, but not in this case, so it's left blank.
So... you say:
SELECT FirstName, LastName
FROM ...
...in which 'FirstName' and 'LastName' are both valid sysname types.
Hope this helps,
Rob
So... you say:
SELECT FirstName, LastName
FROM ...
...in which 'FirstName' and 'LastName' are both valid sysname types.
Hope this helps,
Rob
ASKER
EXEC [dbo].[< stored_procedure_name, sysname, usp_New >]
Here usp_New is style indicator ?
Thanks
Here usp_New is style indicator ?
Thanks
It's an example of what you could use there, showing you the style of how it could work.
Rob
Rob
the 3rd parameter is what will be the default in the template. If you do the following
SELECT <Columns, sysname, *>
FROM <Table, sysname, sys.objects>
and run the template with <CTRL><SHIFT>M you will see that the * and sys.objects will be put in the input boxes as defaults.
SELECT <Columns, sysname, *>
FROM <Table, sysname, sys.objects>
and run the template with <CTRL><SHIFT>M you will see that the * and sys.objects will be put in the input boxes as defaults.
ASKER
CGLuttrell:
I agree with you.
All,
Do we have any comment on that ?
Thanks
I agree with you.
All,
Do we have any comment on that ?
Thanks
Yes - these values get used as the defaults, but I think should only be used as an indicator of style, rather than the value you actually intend to use.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Yup, and then you use the dialog box that appears to provide your own replacement values. So I prefer to put information in there that will help the user provide the right information, describing how the parameter should be used (not just a default value).
I agree, my original comment about the 'style' was misleading - it's based on my way of using templates. But I also think that BOLs comment about "the value that is to replace every occurrence" is also misleading, because the user gets prompted about what value should actually be used.
Rob
I agree, my original comment about the 'style' was misleading - it's based on my way of using templates. But I also think that BOLs comment about "the value that is to replace every occurrence" is also misleading, because the user gets prompted about what value should actually be used.
Rob
GO
IF OBJECT_ID ( 'HumanResources.usp_GetAll
DROP PROCEDURE HumanResources.usp_GetAllE
GO
CREATE PROCEDURE HumanResources.usp_GetAllE
AS
SELECT LastName, FirstName, JobTitle, Department
FROM HumanResources.vEmployeeDe
GO
where did you got this from
SELECT <Columns, sysname, >