Toad World® Forums

Code Complete and aliases


#1

When I start typing code I start by typing “ssf” for a code snippet I
have and then press Ctrl+Space bar to get this:

Then I type the database.owner.tablename and add an alias.

I start adding fields I start by typing " . " (the alias and a period)
and then selecting a field. If I have a function that I want to use I type "
hour( " and the list of available object pops up to select. This is great! Your
competitor makes you at least type “.” Before fields will list. But the
list of fields does not have the alias on them. If an alias is specified for a
table, then the list should show that alias. And anytime they are added from the
list, it should add the alias.

So I select the field I want and below is what I get. A function with parameter
that does not contain the alias and no closing parentheses.

Two things that would be a nice to have, list the parameters that the function
requires like how your Stored Procedures work.

Second, the Code Complete should know that function (in this case hour) only has
one parameter and should put the closing parentheses after the last parameter
which it does not.

I have tested it with two tables that have the same field name and it will add
the alias then.

image004.jpeg

image008.jpeg

image011.jpeg

image012.jpeg

image015.jpeg
image004.jpeg


#2

Sorry about this…Hour is not a function. I use Year all the time and this
must have been the first time I tried to use hour. I would have to use
Datepart() for getting hour.

And if I could have ever got this code finished in Toad, I would have found that
out before I sent this not. I found out after I sent this note while finishing
my code in SSMS that hour is not a valid code.

But just substitute hour for year and all the same problems and suggestions
below.

Sorry about that.
image015.jpeg


#3

Sorry about this…Hour is not a function. I use Year all the time and this
must have been the first time I tried to use hour. I would have to use
Datepart() for getting hour.

And if I could have ever got this code finished in Toad, I would have found that
out before I sent this not. I found out after I sent this note while finishing
my code in SSMS that hour is not a valid code.

But just substitute hour for year and all the same problems and suggestions
below.

Sorry about that.
image004.jpeg


#4

Sorry about this…Hour is not a function. I use Year all the time and this
must have been the first time I tried to use hour. I would have to use
Datepart() for getting hour.

And if I could have ever got this code finished in Toad, I would have found that
out before I sent this not. I found out after I sent this note while finishing
my code in SSMS that hour is not a valid code.

But just substitute hour for year and all the same problems and suggestions
below.

Sorry about that.
image004.jpeg


#5

Sorry about this…Hour is not a function. I use Year all the time and this
must have been the first time I tried to use hour. I would have to use
Datepart() for getting hour.

And if I could have ever got this code finished in Toad, I would have found that
out before I sent this not. I found out after I sent this note while finishing
my code in SSMS that hour is not a valid code.

But just substitute hour for year and all the same problems and suggestions
below.

Sorry about that.
image003.jpeg


#6

Sorry about this…Hour is not a function. I use Year all the time and this
must have been the first time I tried to use hour. I would have to use
Datepart() for getting hour.

And if I could have ever got this code finished in Toad, I would have found that
out before I sent this not. I found out after I sent this note while finishing
my code in SSMS that hour is not a valid code.

But just substitute hour for year and all the same problems and suggestions
below.

Sorry about that.
image002.jpeg