dbo.sp_separo_nombres

Description

Properties

Name Value
ANSI Nulls ON

True

Quoted Identifier ON

True

Encrypted

False

Execute As
Assembly

Parameters

1
Name Data Type Length Description
@Nom varchar 70

SQL Script

Copy
SET QUOTED_IDENTIFIER, ANSI_NULLS ON
GO
-- =============================================
-- Author: María Inés Soria
-- Create date: 2017-12-05
-- Description: Ingresa Nombre, devuelve palabras separadas
-- =============================================
-- sp_separo_nombres 'SORIA MARIA INES SORIA MARIA INES '
CREATE OR ALTER PROCEDURE dbo.sp_separo_nombres
@Nom VARCHAR(70)

AS
BEGIN
 
 DECLARE @pos               SMALLINT

 set @Nom = ltrim(rtrim(@Nom))+' '

 set @pos = (select CHARINDEX(' ',@nom))
 while @pos != 0 
 begin
  select SUBSTRING(@nom,1,@pos)
  set @nom = SUBSTRING(@nom,@pos+1,70)  
  set @pos = (select CHARINDEX(' ',@nom))
 end 

END 

GO

Depends On

No items found