Tuesday, March 20, 2012
Reversing a box checked in a moment of foolishness
I KNOW it said "from now on", but I didn't think it MEANT it ;)Originally posted by TallCowboy0614
Any idea how I can *blush* get my database server registration wizard back after checking the box next to the prompt "From now on I want to perform this task without using a wizard"?
I KNOW it said "from now on", but I didn't think it MEANT it ;)
Click Tools|Wizard... and you should be okay|||Tried that, but can't see anything that looks like it on any of the sub-lists for the wizards displayed.
Any idea what it's called? I looked for something like "server registration wizard" but can't find that or anything that looks like it.
(all this for trying to remove/reregister a server to get my SET QUOTED_IDENTIFIER ON
SET ANSI_NULLS ON
options to work when I create a new SP and/or FN - but I'll do a thread search and then come back on that one if I need to...)
Thanks,
Paul|||Why do you want it?
I couldn't turn it off fast enough...|||I'm not sure I DO want it...*LOL* Just new to the toolset, and didn't want to prematurely jettison a possible future option ;)|||Nah, don't worry, you don't need it...
There are potentially much more hazardous thing to really screw up...
Hav a nice day
:)|||T'Q then...and on to more hazardous stuff :D
Tuesday, February 21, 2012
Returning last row only
I have a web application that is data driven from a SQL 2005 database. The application needs to prompt the user to enter some information that will be logged into a SQL table.
It should always be the last row in the table that is being worked on at any one time. Over a period the user will need to enter various fields. Once the data is entered into a field they will not have access to amend it.
Therefore I need to be able to SELECT the last row of a table and present the data to the user with the 'next field' to be edited.
As I'd like to do this as a stored procedure which can be called from an ASP page I wonder if anyoen might be able to help me with some T-SQL code that might achieve it?
Regards
Clive
I will assume that the table has an integer identity primary key. The SQL then becomes very simple:
SELECT A,B,C FROM TABLENAME WHERE ID = (SELECT MAX(Id) FROM TABLENAME)
|||Yes the ID field is exactly as you say. That works perfectly - many thanks
Clive
|||Another way to do is:
select top 1 visitid from medications order by visitid desc
It will return the last row only.