Showing posts with label age. Show all posts
Showing posts with label age. Show all posts

Monday, March 26, 2012

getting in textbox while retrieving

hi,
I am using sql server database. In my table i am having three columns namely Name, age and salary. I am having three textboxes in my webform to retrieve data from the database.The column salary has no value in the database. When i retrieve the values in to textbox controls, i am getting in my textbox for the salary field.

How to overcome this.?

pls help

Are you HTML Encoding the values that appear in the TextBox?|||

(1) It is a good idea to default 0 in the column.(2) You could do a convert to double in the front end.

If you still have problems please post some code as to how you are populating the textbox.

Friday, March 9, 2012

Get the old SQL servername

I recall a method to get the old servername of a SQL server but old age has gotten to me.
I suspect a particular server has been renamed at one point. Obviously it wasn't me and the person before me is not around for me to ask.
So, can someone help an old guy out?

The results of print @.@.servername is NULL.

ThanksWhat OS? Which version of SQL?

If @.@.SERVERNAME is null it usually means that the sysservers entry is missing.

I'm not positive where to look for the old name, but a good place to start would be the registry. Look in HKLM\SOFTWARE\Microsoft\Microsoft SQL Server\InstalledInstances.

Regards,

hmscott|||SELECT datasource
FROM master.dbo.sysservers
WHERE 0 = srvid-PatP

Wednesday, March 7, 2012

Get the 3 max age

Hi,
I have a table with
ID int,
Name varchar,
Age int
how could i make an stored procedure to get the three old persons from
database?
--
Thanks
Regards.
JosemaTry:
select top 3 * from TheTable
order by Age desc|||Wouldn't it make more sense to store date of birth rather than age? How
will you keep the Age column up to date?
SELECT TOP 3 WITH TIES id, name, age
FROM YourTable
ORDER BY age DESC
Presumably there could be several people with the same age so you may
well get more than 3 rows returned. Do you have a rule for the 3 you
want in the event of ties? You can add other columns to the ORDER BY
clause to narrow down the selection.
David Portas
SQL Server MVP
--|||Thanks bd,
Regards.
Josema
"bd" wrote:

> Try:
> select top 3 * from TheTable
> order by Age desc
>|||> Wouldn't it make more sense to store date of birth rather than age? How
> will you keep the Age column up to date?
Heh... run a job every day that joins against a linked server (e.g. the IRS
database) on SSN, and checks if their DOB has the same day and month as
today. I'm sure it gets even more interesting on Feb. 29. :-)|||>> Heh... run a job every day that joins against a linked server
And for those who are into astrological beliefs, the job has to be scheduled
to run every minute or perhaps every sec!
Anith