Click here to Skip to main content
15,888,019 members
Home / Discussions / Database
   

Database

 
GeneralRe: Hi everyone i am a new comer for this forum ,I have a small problem with format the xml to a table in SQL SERVER stored procedure Pin
Wendelius24-Feb-11 10:43
mentorWendelius24-Feb-11 10:43 
GeneralRe: Hi everyone i am a new comer for this forum ,I have a small problem with format the xml to a table in SQL SERVER stored procedure Pin
Thabo@Codeproject9-Mar-11 9:13
Thabo@Codeproject9-Mar-11 9:13 
GeneralRe: Hi everyone i am a new comer for this forum ,I have a small problem with format the xml to a table in SQL SERVER stored procedure Pin
Wendelius9-Mar-11 11:25
mentorWendelius9-Mar-11 11:25 
AnswerRe: Hi everyone i am a new comer for this forum ,I have a small problem with format the xml to a table in SQL SERVER stored procedure Pin
Luc Pattyn18-Feb-11 5:24
sitebuilderLuc Pattyn18-Feb-11 5:24 
GeneralRe: Hi everyone i am a new comer for this forum ,I have a small problem with format the xml to a table in SQL SERVER stored procedure Pin
Thabo@Codeproject18-Feb-11 5:39
Thabo@Codeproject18-Feb-11 5:39 
GeneralRe: Hi everyone i am a new comer for this forum ,I have a small problem with format the xml to a table in SQL SERVER stored procedure Pin
Luc Pattyn18-Feb-11 5:45
sitebuilderLuc Pattyn18-Feb-11 5:45 
QuestionHow to get a specified number of records centered on a specific record in T-SQL Pin
Member 225653318-Feb-11 4:42
Member 225653318-Feb-11 4:42 
AnswerRe: How to get a specified number of records centered on a specific record in T-SQL Pin
Wendelius18-Feb-11 5:13
mentorWendelius18-Feb-11 5:13 
Hi,

One way of doing this could be:
select * 
from  orders a
where a.customer = 'A'
and ( a.id in (select top(2) id
	       from  orders b
               where b.customer = a.customer
               and   b.id       < 26
               order by b.id desc)
   or
      a.id in (select top(3) id
	       from  orders b
               where b.customer = a.customer
               and   b.id       >= 26
               order by b.id asc))

The above (not tested) should fetch 5 rows. ID 26 and 2 rows from both sides
The need to optimize rises from a bad design.My articles[^]

GeneralHave you seen a sql tool? [modified] Pin
Tomz_KV18-Feb-11 2:42
Tomz_KV18-Feb-11 2:42 
GeneralRe: Have you seen a sql tool? Pin
Henry Minute18-Feb-11 2:45
Henry Minute18-Feb-11 2:45 
GeneralRe: Have you seen a sql tool? Pin
Brady Kelly18-Feb-11 2:50
Brady Kelly18-Feb-11 2:50 
GeneralRe: Have you seen a sql tool? Pin
Henry Minute18-Feb-11 2:52
Henry Minute18-Feb-11 2:52 
GeneralRe: Have you seen a sql tool? Pin
Tomz_KV18-Feb-11 2:50
Tomz_KV18-Feb-11 2:50 
GeneralRe: Have you seen a sql tool? Pin
Tomz_KV18-Feb-11 3:15
Tomz_KV18-Feb-11 3:15 
GeneralRe: Have you seen a sql tool? Pin
Henry Minute18-Feb-11 3:17
Henry Minute18-Feb-11 3:17 
GeneralRe: Have you seen a sql tool? Pin
Brady Kelly18-Feb-11 2:46
Brady Kelly18-Feb-11 2:46 
GeneralRe: Have you seen a sql tool? Pin
Tomz_KV18-Feb-11 2:50
Tomz_KV18-Feb-11 2:50 
GeneralThe answer Pin
Ennis Ray Lynch, Jr.18-Feb-11 3:23
Ennis Ray Lynch, Jr.18-Feb-11 3:23 
GeneralRe: The answer Pin
Tomz_KV18-Feb-11 3:58
Tomz_KV18-Feb-11 3:58 
GeneralRe: Have you seen a sql tool? Pin
Steve Wellens18-Feb-11 3:40
Steve Wellens18-Feb-11 3:40 
GeneralRe: Have you seen a sql tool? Pin
Tomz_KV18-Feb-11 3:59
Tomz_KV18-Feb-11 3:59 
GeneralRe: Have you seen a sql tool? Pin
PIEBALDconsult18-Feb-11 4:26
mvePIEBALDconsult18-Feb-11 4:26 
GeneralRe: Have you seen a sql tool? Pin
fjdiewornncalwe18-Feb-11 4:43
professionalfjdiewornncalwe18-Feb-11 4:43 
Questionquery problem Pin
Dhyanga17-Feb-11 5:47
Dhyanga17-Feb-11 5:47 
AnswerRe: query problem Pin
Chris Meech17-Feb-11 6:05
Chris Meech17-Feb-11 6:05 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.