How to write a sql2000 query statement may have loops or cursors

Updated on technology 2024-05-20
11 answers
  1. Anonymous users2024-02-11

    Loops or cursors can only be used in stored procedures, and it is recommended to use stored procedures to solve complex situations like yours.

  2. Anonymous users2024-02-10

    select , zsl, ,1 sxfrom stk t1, stkdtl t2where =

    and = 1

    union all

    select , zsl, ,1 sxfrom stk t1, stkdtl t2where =

    and = 2

    union all

    select , zsl, ,2 sxfrom stk t1, stkdtl t2where =

    and = 2

    union all

    select , zsl, ,1 sxfrom stk t1, stkdtl t2where =

    and = 3

    union all

    select , zsl, ,2 sxfrom stk t1, stkdtl t2where =

    and = 3

    union all

    select , zsl, ,3 sxfrom stk t1, stkdtl t2where =

    and = 3

    Although it is troublesome, you can only rely on SQL query statements to achieve the loop...

  3. Anonymous users2024-02-09

    The SQL cursor can also be seen as a kind of loop, and the select number from student has more than one record queried here, so it will continue to loop.

  4. Anonymous users2024-02-08

    To define cursor handling, the following is to find out the utterances that match the criteria.

    select *

    from table

    where column name like'w%'

    and Listed Names ='w6001'

    and Listed Names ='w6300'

  5. Anonymous users2024-02-07

    close tnames_cursor

    To release after closing, that is, to delete.

    deallocate tnames cursor -- release the cursor.

  6. Anonymous users2024-02-06

    select top1 customerid from indicates that only one row is taken. The meaning here is to take the customerID column of a row.

    distinct customerid means to filter out duplicate data. Only unique rows are displayed.

  7. Anonymous users2024-02-05

    1. Fetch the customerID of the first piece of data in the subquery result.

    2. No, you cannot. top 1 is the first entry of the query result, and distinct is to remove the duplicates of the query result, and the two have different meanings.

  8. Anonymous users2024-02-04

    SQL (Standard Structured Query Language) does not include program flow control statements, while Microsoft's T-SQL (Enhanced Structured Query Language) has circular statements (while).

    For example: declare @num int -- declare the @num memory variable of the integer.

    select @num=0 --the value of the integer variable is 0while @num<10 @num the value of the integer variable is 0 --set, and when the @num is greater than or equal to 10, the loop will be ended.

    begin -- the beginning of the cycle.

    select @num=@num+1 --Add 1select @num to the @num --Show @num value end --End of the loop body.

    The program execution displays a number of 1-10.

  9. Anonymous users2024-02-03

    SQL doesn't have loops, you have to use processes to implement them, for example.

    beginfor i in 1 ..9 loop

    dbms_;

    end loop;

    end;/

  10. Anonymous users2024-02-02

    No. Looping statements are implemented by a native program such as PHP.

  11. Anonymous users2024-02-01

    You can write a function in a stored procedure or call it in an SQL statement.

Related questions
3 answers2024-05-20

PHP is fully compatible with MSSQL.

1.First of all, you need MS SQL Client Tools is a DLL called, which is usually copied to the system32 folder of the system after MS SQL Server is installed; If SQL Server is local, you need to verify that the version is the same as the SQL Server version (2005 corresponds, 2000 corresponds; If SQL Server is remote, you need to copy that to the system32 folder on your machine; >>>More

13 answers2024-05-20

For example, the name of your table is a

select a.Name, aGrades as Language, BGrades as Mathematics. >>>More

4 answers2024-05-20

select

from[Table name]. >>>More

12 answers2024-05-20

It is recommended that the @orderby int parameter be set to varchar, i.e., pass in the list of fields to be sorted directly. >>>More

7 answers2024-05-20

There is no problem with installing it by following the steps below: >>>More