473,769 Members | 6,107 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

User input in SQL2000

Hello. I'm using SQL query analyzer to run some queries against an
SQL2000 DB. Unfortunately, my previous SQL experience is some Oralce
SQL I took in school.

To put it simply, I'm trying to write a query to pull records that
match a variable input. In Oracle, I'd use a substitution variable
like this...

SELECT * FROM jobs WHERE jobid = &job_id_to_quer y;

Is this possible under SQL2000? Is this only a feature of SQL*Plus?

TIA

Rich

Jul 23 '05 #1
8 5272
Hi,

If it's a one off - use the literal value in the WHERE clause.

If you need to execute it a bunch of times, create a stored procedure
which accepts the jobid as a parameter input and outputs the result
set.

Greg

Jul 23 '05 #2
Try:

DECLARE @job_id_to_quer y int
SET @job_id_to_quer y = 1
SELECT * FROM jobs WHERE jobid = @job_id_to_quer y

--
Hope this helps.

Dan Guzman
SQL Server MVP

<rg*******@bell south.net> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Hello. I'm using SQL query analyzer to run some queries against an
SQL2000 DB. Unfortunately, my previous SQL experience is some Oralce
SQL I took in school.

To put it simply, I'm trying to write a query to pull records that
match a variable input. In Oracle, I'd use a substitution variable
like this...

SELECT * FROM jobs WHERE jobid = &job_id_to_quer y;

Is this possible under SQL2000? Is this only a feature of SQL*Plus?

TIA

Rich

Jul 23 '05 #3

Dan Guzman wrote:
Try:

DECLARE @job_id_to_quer y int
SET @job_id_to_quer y = 1
SELECT * FROM jobs WHERE jobid = @job_id_to_quer y

--
Hope this helps.

Dan Guzman
SQL Server MVP

<rg*******@bell south.net> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Hello. I'm using SQL query analyzer to run some queries against an
SQL2000 DB. Unfortunately, my previous SQL experience is some Oralce SQL I took in school.

To put it simply, I'm trying to write a query to pull records that
match a variable input. In Oracle, I'd use a substitution variable
like this...

SELECT * FROM jobs WHERE jobid = &job_id_to_quer y;

Is this possible under SQL2000? Is this only a feature of SQL*Plus?
TIA

Rich


Would this codepiece bring up a user input prompt upon execution and
then run the query using the input that's passed? That was my
experience under Oracle MySQL.
Thanks for your response!

Rich

Jul 23 '05 #4
Nope, SQL Server QA doesn't have that capability..

You should be able to get what you need without the prompt though -
right?

Greg

Jul 23 '05 #5
> Would this codepiece bring up a user input prompt upon execution and
then run the query using the input that's passed? That was my
experience under Oracle MySQL.
Sorry I missed the prompt part of your requirement. Query Analyzer is more
of a DBA utility than an end user reporting tool. The closest thing is QA
is a template script like the example below. You can paste the script in a
QA window and press shift-ctrl-M to display the parameter replacement
window. Then click replace all and execute. You can save commonly used
template scripts in your QA template folder for easy selection using the
object browser.

SELECT * FROM jobs
WHERE jobid = <job_id_to_quer y, int,>

--
Hope this helps.

Dan Guzman
SQL Server MVP

<rg*******@bell south.net> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
Dan Guzman wrote:
Try:

DECLARE @job_id_to_quer y int
SET @job_id_to_quer y = 1
SELECT * FROM jobs WHERE jobid = @job_id_to_quer y

--
Hope this helps.

Dan Guzman
SQL Server MVP

<rg*******@bell south.net> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
> Hello. I'm using SQL query analyzer to run some queries against an
> SQL2000 DB. Unfortunately, my previous SQL experience is some Oralce > SQL I took in school.
>
> To put it simply, I'm trying to write a query to pull records that
> match a variable input. In Oracle, I'd use a substitution variable
> like this...
>
> SELECT * FROM jobs WHERE jobid = &job_id_to_quer y;
>
> Is this possible under SQL2000? Is this only a feature of SQL*Plus? >
> TIA
>
> Rich
>


Would this codepiece bring up a user input prompt upon execution and
then run the query using the input that's passed? That was my
experience under Oracle MySQL.
Thanks for your response!

Rich

Jul 23 '05 #6
Well, what I'm trying to do is dump an SQL query into a command for
Crystal Reports reporting. I need the report to ask me for input upon
execution and have the SQL query return the results into the report
based on the input.

Thanks for your repsonse!

Rich

Jul 23 '05 #7
I don't know much about Crystal but I'm certain that Crystal can bind input
parameters to the SQL statement(s) needed for reporting. The parameter
values can be supplied to Crystal by your application at runtime.

You might try a Crystal reports forum
http://support.businessobjects.com/forums/default.asp.
--
Hope this helps.

Dan Guzman
SQL Server MVP

<rg*******@bell south.net> wrote in message
news:11******** **************@ l41g2000cwc.goo glegroups.com.. .
Well, what I'm trying to do is dump an SQL query into a command for
Crystal Reports reporting. I need the report to ask me for input upon
execution and have the SQL query return the results into the report
based on the input.

Thanks for your repsonse!

Rich

Jul 23 '05 #8
Will do. Thanks!

Rich

Jul 23 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1263
by: John | last post by:
Hi All, If I want to deploy an C#+SQL2000 application to client site, does the client computer need to have SQL2000 server at all ? or the relevant database and tables will be collected during the process of creating an installer ? Thanks John
1
2187
by: Anote Sangkunakupt | last post by:
I have created a virtual cube in SQL2000. Then, I have generated a Calculated Member. When I did rollup into a higher level, SQL2000 did re-calculate the member. However, I want to summerize the Calculated member. The Solve Order could not be worked in this situation since a measure, which is used to generate the Calculate Member, will be available only in the lowerest level of the dimension. Please help me!
1
2554
by: Cobra Pilot | last post by:
I am hoping someone in this group can lead me to some whitepapers that discuss converting a legacy AS400 DB2 database to SQL2000 using DTS. I believe the AS400 is SNA so I'll probably need to connect through a Host Integration server. I don't need the details now, just a high level overview.
0
1573
by: Michael | last post by:
Hi All, I am working on my intranet reporting web site, by use of IIS5 + Office2000 +SQL2000. Currently, the first step, I show user an ASP web-interface to collect user input, keyword etc.,use "<Form name=xxxx Action=MyAction.ASP method=post>........</Form>" then these user input values will be submit to action page to run reports for user.
2
1409
by: Ger Eielts | last post by:
Hi all, I am brandnew with SQL2000, so sorry in advance for stupidities.... SQL2000, SP3, running on a SBS2003-server with WindowsSharePoint Services. I want to make a dataconnection (from within the LAN with InfoPath) from a client to this server. I got the error that whether the server doesnot exists (it does) or no permission. Where can I find (in SQL2000) which users have access to the databases ???
12
1354
by: Robert Bravery | last post by:
HI all, I downloaded vbexpress and am trying to connect to my sql 2000 server, but keep on getting this error messag: "An error occured while establishing a conenction to the server. When connecting to SQL server 2005, this failure may be caused by the fact that under the default settings SQL server does not allow remote connections" My sqlserver2000 is running. I can connect to it via VS2003, and via dBASE. So I know its workin.
2
1691
by: PointMan | last post by:
i make a project in vs2005 that use ASPNETDB.MDF and use <asp:LoginView ID="LoginView1" runat="server" > server control for vs2005 in this case , i'd like to use hosting service but this hosting company does not support sql2005 that's why i have to use sql2000 so my quetion is how can i migration this for sql2000??
0
1730
by: basuritta | last post by:
I am trying to add a SQL2000 subscriptor to a SQL2005 publisher and distributor using the Management Studio. I'm using a non-standard port in both ends, but I have set the port for the TCP/IP protocol to the non-standard port in both the server and client network configuration. I can add the SQL2000 server to the Management Studio console without problems, and even without haveing to specify the port I'm using (as expected)
7
3511
by: jc | last post by:
Hello, a question for the MS Access community, from someone who programs with SQL in SQL2000. I currently create a table with varying column names and data within SQL2000. I then need to reproduce the same in a Access file DB. The normal functions available with SQL2000 such as OpenRowSet are good for Insert, Select etc., but not the simple "DDL" task of creating a table. Can another help/suggest ?
0
9589
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10045
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9994
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9863
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7408
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5298
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5447
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3958
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.