Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to Update columns in the cursor?
Message
 
 
À
05/06/2002 14:56:56
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Autre
Divers
Thread ID:
00664741
Message ID:
00665230
Vues:
26
In this case you can create UDF that will return skills list for the candidate ID passed as parameter. Something like
CREATE FUNCTION GetCandidateSkills ( @CandidateId )
RETURNS varchar(500)
AS
BEGIN
   DECLARE @skills varchar(500)
   ...
   -- Build @skills here
   ...
   RETURN @skills
END
...
-- In query replace SPACE(500) AS SKILLS with 
   ... GetCandidateSkills(cdt_num_cdtID) AS skills
...
Remember that UDF could slow down query significantly.

>Here is the code for creating Temp. Table.
>
>SET @vch_WhereString = 'SELECT cdt_num_RegistrationId, cdt_num_cdtID, cdt_int_CategoryId, cdt_int_JobId,
>RTRIM(cdt_vch_FirstName) + SPACE(1) + RTRIM(cdt_vch_MiddleName) + SPACE(1) + RTRIM(cdt_vch_LastName) AS Name,
>cdt_vch_Email, cdt_vch_Password, SPACE(500) AS SKILLS
>INTO #tmp_Candidates FROM Candidates ' + @vch_WhereString
>
>EXEC(@vch_WhereString)
>
> SKILLS is the dummy column with SPACE(500). Which I need to update from Candidate's child table called SKILLS. In SKILLS table I have multiple skills for each candidate. Using all child records I need to build string and update back to #tmp_Candidates table for perticular candidate. Is it possible?
>
>Thanks,
>
>Ravi
--sb--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform