Hi,
I have a problem here when I code stored procedure to manipulate data
in database. My idea is that if I can save all data I get in some
arrays I should be able to manipulate the arrays directly. But I do
not know how to declare arrays in SQL server stored procedure and do
not know other ways to do the same thing. Please help me out. Thanks
in advance.
-mingzhen 4 8779
There are no 'arrays' or array datatypes in SQL Server. Generally developers
come up with many work arounds using strings, XML etc. You can find an
exhaustive article at : http://www.algonet.se/~sommar/arrays-in-sql.html
--
- Anith
( Please reply to newsgroups only )
[posted and mailed, please reply in public]
mingzhen (mi*********@ya hoo.com) writes: I have a problem here when I code stored procedure to manipulate data in database. My idea is that if I can save all data I get in some arrays I should be able to manipulate the arrays directly. But I do not know how to declare arrays in SQL server stored procedure and do not know other ways to do the same thing. Please help me out. Thanks in advance.
It sounds like you are used to programming in 3GL, and want to apply
the same methods there. Actually, there are arrays in SQL, just
there right before your eyes. But they are not called arrays, but
tables, and are in many extents much more powerful than arrays. Arrays
you typically handle sequentially. While you can do this with a table,
you can also apply operations on many rows at the same time, which is
usually several magnitudes faster than sequential processeing.
--
Erland Sommarskog, SQL Server MVP, so****@algonet. se
Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp
Yes, I know that sometimes table can be more flexible than arrays. But
my main problem is that I want to abstract data from each record in
the table, and concatenate these dat a into one string. Then I can
compare these strings to chech if there are some duplicate records in
the specific table.
So, my problems are:
1. identify primary key field in a specific table
2. concatenate data from fields except primary key field in one record
into one string, and different strings for different records in the
table
HOw can I do this using table or other methods? Thanks for help.
--mingzhen
Erland Sommarskog <so****@algonet .se> wrote in message news:<Xn******* *************@1 27.0.0.1>... [posted and mailed, please reply in public]
mingzhen (mi*********@ya hoo.com) writes: I have a problem here when I code stored procedure to manipulate data in database. My idea is that if I can save all data I get in some arrays I should be able to manipulate the arrays directly. But I do not know how to declare arrays in SQL server stored procedure and do not know other ways to do the same thing. Please help me out. Thanks in advance.
It sounds like you are used to programming in 3GL, and want to apply the same methods there. Actually, there are arrays in SQL, just there right before your eyes. But they are not called arrays, but tables, and are in many extents much more powerful than arrays. Arrays you typically handle sequentially. While you can do this with a table, you can also apply operations on many rows at the same time, which is usually several magnitudes faster than sequential processeing.
mingzhen (mi*********@ya hoo.com) writes: Yes, I know that sometimes table can be more flexible than arrays. But my main problem is that I want to abstract data from each record in the table, and concatenate these dat a into one string. Then I can compare these strings to chech if there are some duplicate records in the specific table.
So, my problems are: 1. identify primary key field in a specific table 2. concatenate data from fields except primary key field in one record into one string, and different strings for different records in the table
HOw can I do this using table or other methods? Thanks for help.
I'm really sure that I follow, so I like to make the following standard
suggestion. Post a script that contains CREATE TABLE statement(s) for
the involved table(s) (preferably simplified) and INSERT statements
with sample data. With the script, include the desired result.
--
Erland Sommarskog, SQL Server MVP, so****@algonet. se
Books Online for SQL Server SP3 at http://www.microsoft.com/sql/techinf...2000/books.asp This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Yves Touze |
last post by:
Hi All,
I'm trying to migrate from SQL Server 7.0 to SQL Server 2000.
I've got some ASP page which call VB components that retrieve shaped
recordsets from SQL Server using the MSDATASHAPE provider.
Precisely, here is the code i have
Dim Cmdobj As New ADODB.Command
Cmdobj.ActiveConnection = oconn
Cmdobj.CommandType = adCmdStoredProc
|
by: Robin Lawrie |
last post by:
Hi again, another problem!
I've moved from an Access database to SQL server and am now having trouble
inserting dates and times into seperate fields. I'm using ASP and the code
below to get the date and time, but my script is erroring.
'-- Get login date and time
cmdLoginDate = Date()
cmdLoginTime = Time()
|
by: Niyazi |
last post by:
Hi,
Me again. I want to create a SQL Server StoreProcedure and I want to access
it with ADO.NET. I am using VB.NET.
Creating StoreProcedure it was easy but my question is this.
I have table with 4 Column and 6 rows. In the Column 3 for all rows I have
to insert data. The data considt of the decimal value of Croiss Exchange and
6 my...
|
by: Amber |
last post by:
Stored procedures are faster and more efficient than in-line SQL
statements. In this article we will look at two SQL Server stored
procedures; one using an input parameter and one not, and see how to
call them from an ASP.Net page
Every modern database system has a stored procedure language. SQL
Server is no different and has a relatively...
|
by: Jobs |
last post by:
Download the JAVA , .NET and SQL Server interview with answers
Download the JAVA , .NET and SQL Server interview sheet and rate
yourself. This will help you judge yourself are you really worth of
attending interviews. If you own a company best way to judge if the
candidate is worth of it.
http://www.questpond.com/InterviewRatingSheet.zip
| |
by: Alan T |
last post by:
Currently our SQL Server 2000 database table field is using char to store as
boolean, ie. "T" or "F".
Now we change the field from char to bit field. I am not sure how it has
impact on the C# code.
For example, the stored procedure returns
SELECT *
FROM employee
There is a field "ismale", "T" is male, "F" is female.
|
by: eighthman11 |
last post by:
I'm calling a stored procedure on a sql server from an access
application. I just need the stored procedure to run I do not need any
data returned from the stored procedure to my Access application but I
do pass parameters from my Access application. What I have works fine
and is attached below. But I have one question. Why do I need this...
|
by: rbg |
last post by:
I did use query plans to find out more. ( Please see the thread BELOW)
I have a question on this, if someone can help me with that it will be
great.
In my SQL query that selects data from table, I have a where clause
which states :
where PermitID like @WorkType
order by WorkStart DESC
|
by: Light |
last post by:
Hi all,
I posted this question in the sqlserver.newusers group but I am not getting
any response there so I am going to try it on the fine folks here:).
I inherited some legacy ASP codes in my office. The original code's backend
is using the SQL Server 2000 and I am testing to use it on the Express
edition.
And I run into the following...
|
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...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
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...
|
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...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
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
| |