Home > database >  How many rows of data retrieval in pb when integrated into a single data
How many rows of data retrieval in pb when integrated into a single data

Time:10-05

The first is the pb and SQL server 2000.
The following table
Project name card number category name
1 check 1 zhang
1 check 2 threes
1 check 3 threes
2 check test
1, dick, and harry2 check test
2, dick, and harry

Retrieve the hope is the result of the
Project name card number category name
1 check check, check, 2 check 2 threes
2 check test 1, test 2 li si
Which tall person to give directions.

CodePudding user response:

Retrieve the hope is the result of the
Project name card number category name
1 check check, check, 2 check 3 threes
2 check test 1, test 2 li si
Write a check 3 2 fast typing.

CodePudding user response:

You read it out to use cursor will record asm strings together

CodePudding user response:

This method is not appropriate, need in the table in the middle of the piece,

Originally want to use a function
The create function fmerg (@ id varchar (100))
Returns a varchar (1000)
As
The begin
Declare @ STR varchar (1000)
The set @ STR='
Select @ STR=@ STR + ', '+ zm the from a where xm=@ id
The set @ STR=right (@ STR, len (@ STR) - 1)
Return (@ STR)
End
So you can directly select distinct id, fmerg (id) from a

But:
In sql2000, compatibility level is 65, tip error:
Must declare variables' @ id '
In this context cannot be used with a return value return statement
In the front and declare @ id varchar (100) also no

But the sql2000 compatibility level to 80 is not an error, you can call
The problem is our database from 65 to upgrade, compatible with the level must be 65
What solution?
thank you

CodePudding user response:

This function can reach the effect? I to the function in the sql2000 don't understand, can be looked as if she can't achieve a goal

CodePudding user response:

Can be achieved, that is, must be compatible with the level of 80 sql2000 can establish the function,

CodePudding user response:

In SQL SERVER 2000, the level of compatible to 80

CodePudding user response:

An SQL statement cannot be solved, be sure to read line by line and then pieced together

If the database background processing, just write a stored procedure
If the database front-end processing, was in the script to assignment with cycle, generally don't use computed columns under reference function in the processing, this operation, will make every time data window scroll bar has a drag, will perform a function, data in large, feel slow, it is better to direct assignment in the script,

Because assignment need dw grammar has a field, so, you can in the definition of dw, joining a select word value is as follows:
Select the convert (varchar (100), ' ') as a 'project',
.

At this point, the dw will have a length of 100 project name to give you the operation,

CodePudding user response:

Wait for people to answer.

CodePudding user response:

Pick up points is king!
  • Related