Showing posts with label accept. Show all posts
Showing posts with label accept. Show all posts

Friday, March 23, 2012

Prompting for input from user using SQL Server 2000...

I know how to do it in Oracle.
ACCEPT <<variable>> PROMPT 'ENTER VARIABLE: '
How do you do it in SQL Server 2000?SQL Server cannot do this, as SQL Server executes entirely at the server
side. (I take it that you don't want to prompt to pop up on the server
machine?)
So, this has to be done my the client application. None of the tools that
comes with SQL Server has that feature, as they aren't designed to be
end-user tools not development packages.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Jonathan McKinney" <jonmckin@.nycap.rr.com> wrote in message
news:TEL2c.137059$%72.48338@.twister.nyroc.rr.com...
> I know how to do it in Oracle.
> ACCEPT <<variable>> PROMPT 'ENTER VARIABLE: '
> How do you do it in SQL Server 2000?
>|||Hi,
You do not have that kind of facility in SQL Server.
Thanks
Hari
MCDBA
"Jonathan McKinney" <jonmckin@.nycap.rr.com> wrote in message
news:TEL2c.137059$%72.48338@.twister.nyroc.rr.com...
> I know how to do it in Oracle.
> ACCEPT <<variable>> PROMPT 'ENTER VARIABLE: '
> How do you do it in SQL Server 2000?
>|||I want to create a procedure the I can run from Query Analyzer that prompts
the user for input and supplies it to the procedure.
Not a big deal, but the client can do it in Oracle and wonders why SQL
can't.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:OOR%23rXIBEHA.2628@.TK2MSFTNGP11.phx.gbl...
> SQL Server cannot do this, as SQL Server executes entirely at the server
> side. (I take it that you don't want to prompt to pop up on the server
> machine?)
> So, this has to be done my the client application. None of the tools that
> comes with SQL Server has that feature, as they aren't designed to be
> end-user tools not development packages.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
>
> "Jonathan McKinney" <jonmckin@.nycap.rr.com> wrote in message
> news:TEL2c.137059$%72.48338@.twister.nyroc.rr.com...
>|||Hi,
In Query analyzer, Object browser window , right click above the procedure
name and select the debug option. This will ask you to enter the
input parameters of the procedure.
(It may not be same as you required, but allows you to take parameter
values.)
Thanks
Hari
MCDBA
"Jonathan McKinney" <jonmckin@.nycap.rr.com> wrote in message
news:GaM2c.137196$%72.44266@.twister.nyroc.rr.com...
> I want to create a procedure the I can run from Query Analyzer that
prompts
> the user for input and supplies it to the procedure.
> Not a big deal, but the client can do it in Oracle and wonders why SQL
> can't.
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote
in
> message news:OOR%23rXIBEHA.2628@.TK2MSFTNGP11.phx.gbl...
that
>

Prompting for input from user using SQL Server 2000...

I know how to do it in Oracle.
ACCEPT <<variable>> PROMPT 'ENTER VARIABLE: '
How do you do it in SQL Server 2000?SQL Server cannot do this, as SQL Server executes entirely at the server
side. (I take it that you don't want to prompt to pop up on the server
machine?)
So, this has to be done my the client application. None of the tools that
comes with SQL Server has that feature, as they aren't designed to be
end-user tools not development packages.
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
"Jonathan McKinney" <jonmckin@.nycap.rr.com> wrote in message
news:TEL2c.137059$%72.48338@.twister.nyroc.rr.com...
> I know how to do it in Oracle.
> ACCEPT <<variable>> PROMPT 'ENTER VARIABLE: '
> How do you do it in SQL Server 2000?
>|||Hi,
You do not have that kind of facility in SQL Server.
Thanks
Hari
MCDBA
"Jonathan McKinney" <jonmckin@.nycap.rr.com> wrote in message
news:TEL2c.137059$%72.48338@.twister.nyroc.rr.com...
> I know how to do it in Oracle.
> ACCEPT <<variable>> PROMPT 'ENTER VARIABLE: '
> How do you do it in SQL Server 2000?
>|||I want to create a procedure the I can run from Query Analyzer that prompts
the user for input and supplies it to the procedure.
Not a big deal, but the client can do it in Oracle and wonders why SQL
can't.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote in
message news:OOR%23rXIBEHA.2628@.TK2MSFTNGP11.phx.gbl...
> SQL Server cannot do this, as SQL Server executes entirely at the server
> side. (I take it that you don't want to prompt to pop up on the server
> machine?)
> So, this has to be done my the client application. None of the tools that
> comes with SQL Server has that feature, as they aren't designed to be
> end-user tools not development packages.
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
>
> "Jonathan McKinney" <jonmckin@.nycap.rr.com> wrote in message
> news:TEL2c.137059$%72.48338@.twister.nyroc.rr.com...
> > I know how to do it in Oracle.
> >
> > ACCEPT <<variable>> PROMPT 'ENTER VARIABLE: '
> >
> > How do you do it in SQL Server 2000?
> >
> >
>|||Hi,
In Query analyzer, Object browser window , right click above the procedure
name and select the debug option. This will ask you to enter the
input parameters of the procedure.
(It may not be same as you required, but allows you to take parameter
values.)
Thanks
Hari
MCDBA
"Jonathan McKinney" <jonmckin@.nycap.rr.com> wrote in message
news:GaM2c.137196$%72.44266@.twister.nyroc.rr.com...
> I want to create a procedure the I can run from Query Analyzer that
prompts
> the user for input and supplies it to the procedure.
> Not a big deal, but the client can do it in Oracle and wonders why SQL
> can't.
> "Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> wrote
in
> message news:OOR%23rXIBEHA.2628@.TK2MSFTNGP11.phx.gbl...
> > SQL Server cannot do this, as SQL Server executes entirely at the server
> > side. (I take it that you don't want to prompt to pop up on the server
> > machine?)
> > So, this has to be done my the client application. None of the tools
that
> > comes with SQL Server has that feature, as they aren't designed to be
> > end-user tools not development packages.
> >
> > --
> > Tibor Karaszi, SQL Server MVP
> > http://www.karaszi.com/sqlserver/default.asp
> >
> >
> > "Jonathan McKinney" <jonmckin@.nycap.rr.com> wrote in message
> > news:TEL2c.137059$%72.48338@.twister.nyroc.rr.com...
> > > I know how to do it in Oracle.
> > >
> > > ACCEPT <<variable>> PROMPT 'ENTER VARIABLE: '
> > >
> > > How do you do it in SQL Server 2000?
> > >
> > >
> >
> >
>

Wednesday, March 21, 2012

Prompt for login credentials using Windows-NT Authentication

Hello,
I am using a SQL Server (MSDE) db, currently configured to only accept
Windows-NT Authentication logins. This has worked well for a while -
much easier to administer. However I have a group of users that have
presented a special problem.
These users have valid logins under a valid Windows Domain ie
<Domain>\<user>. Unlike most users, however, they do not login to the
windows domain when they log into their machines (instead they login
to the local machine). In cases other than mine, when they access
applications/web services that require authentication to the said
windows domain, they are prompted for login credentials (ie
username=<domain>\<user> and password). They can then proceed to use
the application/web service.
With my SQL Server database, however, this does not happen. When they
attempt to login to my database, I am guessing that the server figures
out that they are not currently logged in to the windows domain, so
denies them access outright. They are given no opportunity to enter
their credentials. They are attempting to access the database using
data access pages / OWC10.
Is there any way that I can setup a connection string which allows me
to continue using Windows-NT Authentication, but will prompt users for
login credentials if they are not currently logged in to the required
Windows Domain?
Thanks heaps for your help.
Nick TompsonIt's been a while since I've worked with data access pages, but as I
recollect the connection is hard-wired into the page. What I think
you're going to have to do is to provide a login where they can join
the domain that is accredited with your SQL Server prior to loading
the page. I could be wrong about this -- you might want to post the
question in the microsoft.public.access.dataaccess.pages ng.
-- Mary
On 2 May 2004 23:48:13 -0700, ntompson@.utas.edu.au (Nick Tompson)
wrote:
>Hello,
>I am using a SQL Server (MSDE) db, currently configured to only accept
>Windows-NT Authentication logins. This has worked well for a while -
>much easier to administer. However I have a group of users that have
>presented a special problem.
>These users have valid logins under a valid Windows Domain ie
><Domain>\<user>. Unlike most users, however, they do not login to the
>windows domain when they log into their machines (instead they login
>to the local machine). In cases other than mine, when they access
>applications/web services that require authentication to the said
>windows domain, they are prompted for login credentials (ie
>username=<domain>\<user> and password). They can then proceed to use
>the application/web service.
>With my SQL Server database, however, this does not happen. When they
>attempt to login to my database, I am guessing that the server figures
>out that they are not currently logged in to the windows domain, so
>denies them access outright. They are given no opportunity to enter
>their credentials. They are attempting to access the database using
>data access pages / OWC10.
>Is there any way that I can setup a connection string which allows me
>to continue using Windows-NT Authentication, but will prompt users for
>login credentials if they are not currently logged in to the required
>Windows Domain?
>Thanks heaps for your help.
>Nick Tompson|||If the users log on to the local machine then that is the login tha SQL
Server expects. You can workaround this problem by creating a user account
on the SQL Server machine with the same name and password as the users who
are logging in and grant that login a login within SQL Server. This should
allow them to log in to SQL Server using the local machine account.
Outside of that I am not sure there is a way, unless you can get the IIS
anonymous login to be used by these users.
Rand
This posting is provided "as is" with no warranties and confers no rights.

Saturday, February 25, 2012

Programatically re-ordering a "DisplayOrder" column

Anyone know of any resources or information on writing a query that would accept a new "DisplayOrder" for a particular row and re-order the column for all other rows?

Thanks in advance!If you are asking the question I think you are asking, I had posted an answer to thishere.

The idea is to bump up the sequence number for each record that has a sequence number greater than or equal to the new sequence number...BUT only if the sequence number already is on file.


IF EXISTS(SELECT NULL FROM myTable WHERE sequence = @.NewSequence)
BEGIN
UPDATE myTable SET sequence = sequence + 1 WHERE sequence >= @.NewSequence
END
UPDATE myTable SET sequence = @.NewSequence WHERE id = @.idToChange

Terri|||Thank You! A few questions...

IF EXISTS(SELECT NULL FROM myTable WHERE sequence = @.NewSequence)

This tests for the existence of the "@.NewSequence" value?
And what exactly is achieved by "SELECT NULL", I haven't seen that before?

I think this will work well for me...

Also, the sequence number must exist as it is selected from a DropDownList populated from the existing sequence.

Again, Thank You!|||The "SELECT NULL" works the same as "SELECT *" or "SELECT columnname" -- the column(s) selected have no bearing on the success of the EXISTS test. I tend to use NULL because I believe that requires the least amount of resources to process. Others choose to use the primary key column. I am honestly not sure how much of a difference there really is.

All that code is doing is checking to see if the new sequence number is already on file. If it is, then it pushes down all of the sequence numbers from that point forward to create a "space".

I'm glad you could make use of the method :-)

Terri