Awesome examples. I created the stored procedure 3 more times, one for each of your examples above. I then tested them each by right clicking on them and choosing execute, then populating the appropriate values for each input variable, and then running the resulting logic. I used the same...
The query takes 00:00:00.078 seconds to run.
Both #LOV and #NOV only return the # of appointments for a given patient, so they could contain a hundred records each, but generally it would be far less than that.
There are 1,902,333 records in the appointments table, and it grows by about 600...
I am building a stored procedure against a SQL 2005 database and need some help optimizing the query. It will end up running several hundred times a day so I want to make it as efficient as possible.
I ended up having to use temp tables to get where i was going, and that is what i would like...
I cannot make any changes to the database structure perse, so i don't think i can enable cascade delete, but i will definately look into using Having instead of temp tables.
thx.
MH
I am working against a mssql 2005 db. I have largely tought myself sql, and as you will probably notice from the script below, I have lots to learn.
The following logic collects encounters that need to be deleted, and then uses a fetch statement to accomplish the deletions. It works, but it...
If either of you care to expound on your statements, I would love some plain english explanations of your syntax.
What is CTE? it looks like you are defining it on the fly using the 'with ctexxx as'. are you using a variable as a table?
What is the Over statement?
I need to look up...
Awesome, I appreciate the help. Clearly i have lots to learn about t-sql. I would be interested to see how you would make the initial query less complex, and how it could be done with a derived table with row number in it.
Thanks, MH
its gonna take me a bit to make sense out of how that works, but in the meantime, i am getting the following syntax error.
Msg 156, Level 15, State 1, Occurred on Line: 1
Incorrect syntax near the keyword 'where'.
I copied and pasted what you sent and then had to clean it up bc the copy/paste...
I am working on a sql statement to collect the top 50 highest patient balances per provider. I am running against a MSSQL2005 db.
At present I have the following, which returns the top 50 for the whole database, not per provider, how do I change this to collect the 50 highest balances per...
OK, no it seems pretty cut and dried using the NOT EXISTS, but I can't seem to get any answers.
Here is the actual query.
select distinct(c.source_id) as enc_id
into #CT
from charges c
inner join patient_encounter pe on pe.enc_id = c.source_id
inner join encounter_payer ep on ep.enc_id =...
oops, that should have been
select c.enc_id,c.sim
into #one
from charges c
where c.sim in ('list of serveral sim codes')
i haven't used the NOT IN or NOT EXISTS before. I will look into those. thx
Im searching a sql database and trying to find where item A exists, but item B doesn't exist.
so far I have something like the following:
select c.enc_id,s.sim
into #one
from charges c
where c.sim in ('list of serveral sim codes')
that gives me a temp table with the encounter ids and the...
I have a windows 2003 standard sp2 server, that appears to be having a problem. The Directory Service log shows the following errors, over and over again.
First error:
Date: 9.9.2007
Time: 8:47:51 AM
Type: Warning
User: N/A
Computer: LRDCDC2
Source: NTDS Inter-Site Messaging
Category...
I am working on a stored procedure to export data from a sql 2005 database. I would like to have the stored procedure create a new table in the database, and then populate it. I am planning on creating a job to have the stored procedure run once a month, and would therefore like the table...
I have about 30 users with roaming profiles in my Windows Server 2003 Active Directory network. I want to move the location where the profiles are stored from one server (a db server) to another (my AD controller).
Is there a problem with having roaming profiles, or home directories, stored on...
I am building an internal page and would like to have a form field on the page automatically populated with the windows user information.
How do I get FrontPage 2003 to query active directory?
Additionally, I would also like to find a way for a field to do a lookup without having to have a...
I am building a CRXI report against a stored procedure on a sql2k db.
The stored procedure is quite simple, and has three input parameters. I want to build a dynamic list for the user to pick from to satisfy one of the parameters, but I cannot find a way to accomplish this.
I need the...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.