Skip to content Skip to sidebar Skip to footer

Is There A "split" Function In T-sql For A SELECT Query

I want to use my function like this SELECT BaseSplit(line,';') FROM table is there any way to do that ??? I try CROSS APPLY but it not what I want My table has a column named lin

Solution 1:

It should work fine, but you need to schema-qualify functions.

IE:

SELECT dbo.BaseSplit(line,';') FROM table

If your function is in a different schema than dbo you should obviously use that instead.

OK - assuming its a table valued function then...

SELECT t.Id, f.*  FROM table AS t CROSS APPLY dbo.BaseSplit(line,';') AS f

That would return a row for each split line + the ID of the that entry in the main table (assuming a column named Id exists in the main table). If you want better that that I'm going to need an example of what output you expect


Post a Comment for "Is There A "split" Function In T-sql For A SELECT Query"