Do I have to convert dates for a .NET developer so they can capture ms?
Or is there a method they are suppose to be using
I had to remove my modified date check to check for data collisions because they can't pass back microseconds.
What's the dealDepending on which of the .NET languages is being used, and in most of them which data type is being used, temporal data can be stored to the day, second, or true millisecond (which is actually more precise than SQL Server can store).
The short answer becomes something like: If you want absolute portability, convert and send them text (character) data. If they are using C#, C++, or VB then they just have to choose the correct data type. Most of the other .NET languages can store times to millieconds, but depending on the language that can be a pain in the patoot.
-PatP|||This dodges the obvious bullet about most developers not being able to even get a date, much less handle one! ;)
-PatP|||i thought this was a craigslist post.|||OK, CONVERT it is
And why is sql server limited in th MS category?
Something about clock speed?
Showing posts with label suppose. Show all posts
Showing posts with label suppose. Show all posts
Sunday, February 19, 2012
Tuesday, February 14, 2012
Determining Relevance with Least Amount of Queries
Suppose I have a table of record IDs and known record keywords like
this...
id|keywords
=================================
134|-PRNTR-FL-PRNT-GRDLN-
167|-PRNT-GRDLN-
198|-GRDLN-
009|-PRNT-
451|-XCL-
893|-BLB-
800|-JST-BLX-
(Note vowels removed as a crude form of compression for this example to
be legible.)
...and someone submits a search form with the keyword values...
XCL PRNT GRDLN
...and I want to return a relevance result like...
relevance|id|keywords
=================================
2|134|-PRNTR-FL-PRNT-GRDLN-
2|167|-PRNT-GRDLN-
1|198|-GRDLN-
1|009|-PRNT-
1|451|-XCL-
...where ids 134 and 167 had 2 found occurrences, the others except 893
and 800 had 1 occurrence, and anything else that didn't match is not
returned. The highest number of occurrences are sorted to the top.
How does one achieve this in ANSI-92 SQL in the least amount of
queries?*untested*
select t.*, relevance
from your_table t
join(
select id, count(*) relevance
from your_table t
join (
select '%-XCL-%' token
union all
select '%- PRNT-%'
union all
select '%-GRDLN-%'
) tokens
on t.keywords like token
) r
on t.id = r.id
BTW, your table seems to violate 1NF
this...
id|keywords
=================================
134|-PRNTR-FL-PRNT-GRDLN-
167|-PRNT-GRDLN-
198|-GRDLN-
009|-PRNT-
451|-XCL-
893|-BLB-
800|-JST-BLX-
(Note vowels removed as a crude form of compression for this example to
be legible.)
...and someone submits a search form with the keyword values...
XCL PRNT GRDLN
...and I want to return a relevance result like...
relevance|id|keywords
=================================
2|134|-PRNTR-FL-PRNT-GRDLN-
2|167|-PRNT-GRDLN-
1|198|-GRDLN-
1|009|-PRNT-
1|451|-XCL-
...where ids 134 and 167 had 2 found occurrences, the others except 893
and 800 had 1 occurrence, and anything else that didn't match is not
returned. The highest number of occurrences are sorted to the top.
How does one achieve this in ANSI-92 SQL in the least amount of
queries?*untested*
select t.*, relevance
from your_table t
join(
select id, count(*) relevance
from your_table t
join (
select '%-XCL-%' token
union all
select '%- PRNT-%'
union all
select '%-GRDLN-%'
) tokens
on t.keywords like token
) r
on t.id = r.id
BTW, your table seems to violate 1NF
Subscribe to:
Posts (Atom)