Quantcast
Channel: Extract values from the String filed in SQL server
Browsing latest articles
Browse All 34 View Live

Extract values from the String filed in SQL server

Hi Red987,Agreed with other experts, it is better for you to create one index on your source table, preferably a clustered index.Then the performance could be better during your query.Or you could have...

View Article



Extract values from the String filed in SQL server

@Guoxiong, The current source table doesn't have any primary key.Then you should not try batching. Batching requires that there is an index you can do the batching over. Preferably a clustered...

View Article

Extract values from the String filed in SQL server

@Naomi, will do. Thanks!

View Article

Extract values from the String filed in SQL server

@Guoxiong, The current source table doesn't have any primary key.

View Article

Extract values from the String filed in SQL server

I have large table with around 50million data that needs to be updated and inserted into then final table. My approach was to apply transformations and then load into temp table and finally loaded data...

View Article


Extract values from the String filed in SQL server

Hi,I believe I posted some samples in the past and you can also find samples in that forum, just do a search for 'INSERT BATCHES SQL SERVER' (for example).Looking for new opportunitiesFor every expert,...

View Article

Extract values from the String filed in SQL server

@Naomi, thanks for responding! Could you please help me out in sending the sample query to load in batches? Even it takes longer time to load from temp to permanent as well?Thanks in advance!

View Article

Extract values from the String filed in SQL server

Try using batches approach for loading into temp table and then back. It's not going to be quick for 50 mln rows, I think 10 min. is probably fine.Looking for new opportunitiesFor every expert, there...

View Article


Extract values from the String filed in SQL server

@Melissa, I am seeing the performance issues with below the logic: selectcasewhen CHARINDEX('Number="',htmlString)>0then...

View Article


Extract values from the String filed in SQL server

Hi Red987, Could you please provide any update ? Please remember to mark the replies as answers if they helped. Your action would be helpful to other users who encounter the same issue and read this...

View Article

Extract values from the String filed in SQL server

Thanks for responding. I am getting this error "Invalid length parameter passed to the LEFT or SUBSTRING function" for below set of data:  Sample data for string: Number of Sales: <Area="XBA"...

View Article

Image may be NSFW.
Clik here to view.

Extract values from the String filed in SQL server

Hi Red987,Please also find another method which has the same query cost with Naomi's query from below.declare @t table (ID int identity(1,1) primary key, htmlString nvarchar(max)) insert into @t...

View Article

Image may be NSFW.
Clik here to view.

Extract values from the String filed in SQL server

Hi Naomi,>> "...Tried both solutions in one batch (and displayed the actual execution plan just to see the winner):..."Is it taking into account maintainability?Some interesting stats: And the...

View Article


Extract values from the String filed in SQL server

Tried both solutions in one batch (and displayed the actual execution plan just to see the winner):declare @t table (ID int identity(1,1) primary key, htmlString nvarchar(max)) insert into @t...

View Article

Extract values from the String filed in SQL server

Hi Naomi, I added a 5th row ('No Sales were happened: SPANISH<UV>END'); My T-SQL stays rock solid. Everything continues to work without any code change.

View Article


Extract values from the String filed in SQL server

Try this:declare @t table (ID int identity(1,1) primary key, htmlString nvarchar(max)) insert into @t (htmlString) values ('Number of Sales: <Area="ABC"...

View Article

Extract values from the String filed in SQL server

Hi Naomi,I added a 4th row ('No pattern at all');.My T-SQL stays rock solid. Everything continues to work without any code change.Please give it a shot.

View Article


Extract values from the String filed in SQL server

@Naomi, Sorry the issue is not due to below sample data: Number of Sales: <Area="XBA" Number="">0</a><XX>ENDThe issue is because of the this kind of data in the same field.No Sales...

View Article

Extract values from the String filed in SQL server

I've adjusted the code, I'm getting null if the pattern doesn't match:declare @t table (ID int identity(1,1) primary key, htmlString nvarchar(max)) insert into @t (htmlString) values ('Number of Sales:...

View Article

Extract values from the String filed in SQL server

CREATE TABLE #temp ( ID int, Sales nvarchar (MAX) ) INSERT INTO #temp VALUES (1,'Number of Sales: <Area="ABC" Number="1012,1013,1014,1015">4</a><ZZ>END'), (2,'Number of Sales:...

View Article

Extract values from the String filed in SQL server

@Yitzhak, thanks for responding. I pluged your logic into my code but I am getting values for Order numbers column as complete NULL's.Hi Red987,Again, I provided you a minimal reproducible example.Did...

View Article


Extract values from the String filed in SQL server

@Yitzhak, thanks for responding. I pluged your logic into my code but I am getting values for Order numbers column as complete NULL's.

View Article


Extract values from the String filed in SQL server

@Naomi, thanks for responding! I will look forward to hear from you on the updated code.

View Article

Extract values from the String filed in SQL server

I'll respond a bit later, doing some exercises now. The common solution is to use NULLIF function, I'll adjust my code in a bit.Looking for new opportunitiesFor every expert, there is an equal and...

View Article

Extract values from the String filed in SQL server

Thanks for responding. I am getting values for Order numbers filed complete NULL's when I plug this logic into my code.Hi Red987,It is not clear whom you are replying to. You need to mention person's...

View Article


Extract values from the String filed in SQL server

Thanks for responding. I am getting this error "Invalid length parameter passed to the LEFT or SUBSTRING function" for below set of data:  Sample data for string: Number of Sales: <Area="XBA"...

View Article

Extract values from the String filed in SQL server

CREATE TABLE #temp ( ID int, Sales nvarchar (MAX) ); INSERT INTO #temp VALUES (1,'Number of Sales: <Area="ABC" Number = "1012,1013,1014,1015">4</a><ZZ>END'), (2,'Number of Sales:...

View Article

Extract values from the String filed in SQL server

Thanks for responding. I am getting this error "Invalid length parameter passed to the LEFT or SUBSTRING function". I missed one more scenario when I asked for solution i think the error might be...

View Article

Extract values from the String filed in SQL server

Thanks for responding. I am getting values for Order numbers filed complete NULL's when I plug this logic into my code.

View Article



Extract values from the String filed in SQL server

Hi Red987,While waiting for the ##1-4.Re-using Naomi's DDL and sample data. Thanks Naomi.The CTE transforms strings into a well-formed XML. It makes very simple to emit the desired output.-- DDL and...

View Article

Extract values from the String filed in SQL server

CREATE TABLE #temp  ( ID int, Sales nvarchar (MAX) ) INSERT INTO #temp VALUES (1,'Number of Sales: <Area="ABC" Number="1012,1013,1014,1015">4</a><ZZ>END'), (2,'Number of Sales:...

View Article

Extract values from the String filed in SQL server

Try:declare @t table (ID int identity(1,1) primary key, htmlString nvarchar(max)) insert into @t (htmlString) values ('Number of Sales: <Area="ABC"...

View Article

Extract values from the String filed in SQL server

Hi Red987, It would be great if you could provide a minimal reproducible example: (1) DDL and sample data population, i.e. CREATE table(s) plus INSERT, T-SQL statements. (2) What you need to do, i.e....

View Article


Extract values from the String filed in SQL server

I have nvarchar field in a SQL server table that contains html string where value need be separated into twoadditional fields and data can be of varying lengths.Number of Sales: <Area="ABC"...

View Article
Browsing latest articles
Browse All 34 View Live




Latest Images