Viewing 15 posts - 286 through 300 (of 395 total)
CptCrusty1 (8/28/2012)
Laurie,Thanks for your reply. The "Values" reserved word didn't fly in 2005. Is that a 2008+ term?
Thanks
Crusty
Hi - Sorry about that, but you've posted in the SQL...
August 28, 2012 at 1:20 pm
select Doc.DocNum, GR.GR, GR_Seq = GR.Seq, GE.GE, GE_Seq = GE.Seq, Ref.Ref, Ref_Seq = Ref.Seq
from Doc
cross join ( values (1),(2),(3),(4),(5),(6),(7),(8),(9) ) N (n)
left outer join GR on GR.DocNum = Doc.DocNum and...
August 28, 2012 at 10:05 am
rothj (8/28/2012)
Thanks for your response Laurie.That is how I was initially attempting to get it done but I was struggling with the Cross Apply.
I appreciate your method.
Post your cross apply...
August 28, 2012 at 9:27 am
rothj (8/28/2012)
I apologize but I left out one detail.
There are other Obsv Codes that begin with A_Med1 etc. (like...
August 28, 2012 at 9:26 am
Another possibility:
--===============================================================================================
-- Test data:
--===============================================================================================
drop table dbo.Medication;
create table dbo.Medication
(
obsv_cd varchar(30),
obsv_cd_name varchar(10),
med_name varchar(30),
med_status varchar(30)
);
insert into dbo.Medication values ( 'ABCDEFG111', '', 'Name1', '' );
insert into dbo.Medication values ( 'ABCDEFG111', 'Status', '', 'New' );
insert...
August 28, 2012 at 9:08 am
The layout for a store procedure is like this:
create procedure dbo.STORED_PROC_NAME
(
@sstrg varchar(100)
)
as
begin
set nocount on;
--declare @strg varchar(100) = 'Catalog',
declare
@sstring varchar(100),
@sstrg1 varchar(100),
@sstrg2 varchar(100)
begin
set @sstring = @sstrg
if @sstring like '%*%'
begin
set...
August 28, 2012 at 8:40 am
No problem.
I learned something too:
I'll put proper notes in the script to explain what I'm doing next time!
August 28, 2012 at 7:20 am
Hi
Creating & deleting the table is just to set up the test data.
You would only run the WITH CTE AS... statement.
The select is to look at the results.
It's just to...
August 28, 2012 at 6:10 am
Will the names always be in the same format TITLE/FIRST/SECOND, or could you have middle names & missing titles, for example?
August 28, 2012 at 6:01 am
If you know already which query is running slowly, you could post it here & let people have a look at it.
It might have obvious problems which could be pointed...
August 28, 2012 at 5:59 am
OK - I didn't notice the BOE_BOERNIDs were out of order. This should handle it:
drop table dbo.boern
create table dbo.boern
(
BOE_BOERNID int,
boe_fornavn varchar(10),
boe_institution varchar(30)
);
insert into dbo.boern values ( 1539,...
August 28, 2012 at 5:44 am
Try this:
;WITH CTE AS
(
select TOP 1000000 BOE_BOERNID,
boe_fornavn
from dbo.boern
where boe_institution = 'Fritidsklub 4/5 kl.'
order by BOE_INSTITUTION,BOE_FORNAVN,BOE_BOERNID
)
DELETE CTE
WHERE boe_Boernid >= 1682;
deleting from the CTE deletes from the underlying...
August 28, 2012 at 5:32 am
Thinking about it, you can set up automatic transactions, although I've never done it:
August 28, 2012 at 4:55 am
raotor (8/28/2012)
Hello,Am I going to have to use BEGIN TRY ... CATCH blocks and ROLLBACK whenever I want a transaction to cleanly rollback when an error occurs?
This is the normal...
August 28, 2012 at 4:46 am
You can do this:
SELECT REPLACE('0,0,'',0,'',0', '0,0', '0,NULL')
This will be OK as long as the pattern only occurs once in the string.
August 28, 2012 at 4:37 am
Viewing 15 posts - 286 through 300 (of 395 total)