sql server - Joining INT column to comma separated list of INTs -


"postprint" itemprop = "text">

I am running SQL Server 2008, and some of the poorly stored data that I do not want to go but escape some queries Trying to try and clean through (millions of rows to deal with) I have a log table with some FK data, in a table as a comma separated strings, and in another table An integer pk I want to be able to join the integer's FK list for the proper PK int in the primary table. My query is like this:

  select L * Includes LOL (NOLOCK) Inside D (NOLOCK) from MyLogs but L.SearchValue = D.ID  

In the above query, L. SearchValue contains "12345645690", while D.D. An integer is the primary key. Is there any way to get together in any way in these efficient ways, or I just accept my luck and?

Comma separated on different lines should start to break the values ​​in different rows. After all

< P>

After that, you need to do any of these (modified for doing ints for ints)

Select L * from MyLogs L (NOLOCK), Description D (NOLOCK) where D.ID fn_WhatEverYouCallYourSplitFunction (L.SearchValue, ',') pre>

and No, it's not efficient at all.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -