Showing Friendly Values In The GUI
Jul 20, 2005
I am new to SQL server and I am looking for the best practice
regarding the following:
The GUI for the database I am creating has a number of questions like:
A. Where are you currently living?
1) In my own home
2) In the home of a family member
3) In a shelter
4) On the street
However, for speed of data entry, the GUI (it's a web front-end,
ASP/VBScript) accepts the number only. Futhermore the database only
stores the number entered.
So for example for the above question, when the user is doing the data
entry, they would just enter a 1, 2, 3, or 4.
However, when viewing the data, the end user wants to see the text
that corresponds to the number. So for example, if the user entered
"3" for the above question, when they are viewing the data in the GUI
(not to make edits, just viewing), they want to see "(3) In a
shelter".
My question is how best to display these friendly values?
Should I do all the conversions in a stored procedure? If so, what
would be the best way to do that? I tried something like this:
SELECT Current_living =
CASE Current_living
WHEN 1 THEN '(1) In my own home with my partner'
WHEN 2 THEN '(2) In the home of a family member'
ELSE NULL
END
FROM tbl_DemographicInfo WHERE ClientID = @ClientID
but I can't figure out how to do this for multiple fields.
ALSO, I'm not sure if burying this stuff in a stored proc is the way
to go, because if the client wants a slight change to the friendly
name I have to get into the SP and change it. Seems like there must
be a better way.
I can also do this in the ASP code, but that also doesn't seem like
the best practice.
I can have a lookup table, but again, where do I do the conversion?
In an SP? With a view?
Again, I'm looking for the best practice here. I know some ways I
could do it (like in the ASP), but I want to do it efficiently and
correctly.
Any help/comments are greatly appreciated.
thanks in advance,
Jon LaRosa
jlarosa at alumni dot brown dot edu
View 2 Replies
ADVERTISEMENT
Oct 23, 2006
how can i show the values of my database in for example texbox.can u give me some simple code on how to connect to my SQldatabase server express? and how i can retrieve the file?thnx
View 2 Replies
View Related
Apr 13, 2007
I have designed a for to submit some info to a sql database, but when i enter the information to the form fields and click submit, I get an error saying that a null value cannot be submitted, when it should not be null.
Not to sound whiney, but i really need a code fix, not links to msdn pages that define properties (usually dont do this, but i have a deadline to submit this to my tech admin of my company's site)
Here is the code, and THANK YOU to anyone who helps me with this!!
<%@ Page Language="VB" MasterPageFile="~/MasterPage.master" %>
<script runat="server">
Private Sub Submitdata(ByVal Source As Object, ByVal e As EventArgs)
SqlDataSource1.Insert()
End Sub ' Submitdata
</script>
<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="ContentPlaceHolder1">
<asp:sqldatasource
id="SqlDataSource1"
runat="server"
connectionstring="<%$ ConnectionStrings:clientInfoConnectionString %>"
selectcommand="SELECT Client Name,Client Address FROM Clients"
insertcommand="INSERT INTO Clients (ClientName,ClientAddress) VALUES (@CName,@CAddress)">
<insertparameters>
<asp:formparameter name="CName" formfield="Namebox" />
<asp:formparameter name="CAddress" formfield="Addressbox" />
</insertparameters>
</asp:sqldatasource>
Name:<br />
<asp:TextBox ID="Namebox" runat="server" /><br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="Namebox"
ErrorMessage="Please Enter A Name"></asp:RequiredFieldValidator>
<br />Address:<br />
<asp:TextBox ID="Addressbox" runat="server" /><br />
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="Addressbox"
ErrorMessage="Please Enter An Address"></asp:RequiredFieldValidator>
<br /><asp:Button ID="Submitbtn" runat="server" Text="Submit" OnClick="Submitdata" />
<br />
</asp:Content>
Thanks,
The King
View 2 Replies
View Related
Jul 19, 2006
Hi all
My query has some inner joins to some tables. And problem is when any ON clause get null as value, the correspondent record is not displayed.
SELECTTableA.A, TableB.AFROM TableAINNER JOIN TableB ON TableA.A = TableB.A
What I did try:
SELECTTableA.A, TableB.AFROM TableAINNER JOIN TableB ON TableA.A = TableB.A OR TableA.A IS NULL
(but It generates redundant values from TableB)
I need to show all values even that value from Tablea is null
Thank a lot for any help
View 1 Replies
View Related
May 25, 2006
I have a stored procedure that returns a set of tables based on data in a table for a company. These tables are being used to create drop down lists for criteria selection for the client. We have a Javascript based control that will make use of these based on the control name. So... ideally, I would like the stored procedure to return tables named "EmployeeID", "ResourceName", so that I can accurately name the controls when they are being created. The data that is returned is not static, so, for example, client 1 may see the EmployeeID drop down, while client 2 may not.
I searched and didnt see anyone that was able to accomplish this in this way, but wanted to post something here before I moved forward in a different direction.
I am thinking that I will likely return an extra table with the field names and their corresponding tables (i.e. "EmployeeID"/"Table0", "ResourceName"/"Table1", etc...)
Thanks,
Josh
View 2 Replies
View Related
May 14, 2007
The notorious situation: a duplicate key exception. Users register themselves using fancy nicknames.This often leads to conflicts. In addition, as I point out in error reporting -- to except or not expect or return, the conflicts can not be prevented in a distributed environment (one ensures that there in no such name and still can get a concurrent conflict). For these reasons, the apps should be prepared to the conflicts. The cases to which apps are prepared, are not exceptional.
Meantime, if the engine insert process fails things naturally, we get an exception with a message like "Violation of UNIQUE KEY constraint 'col_name'. Cannot insert duplicate key in object 'table_name'. At first, it is not quite informative. Customers prefer to see something like: "a user with such a name already exists". Additionally, as explained in the referred topic, exception processing is extremely CPU consuming and should be not normally used as a function "feedback" tool.
The option to prevent the exception raising by preceding the INSERT op by a table-locking SELECT is not attractive either because of 1) locking and 2) double checking. Obviously, we get the conflict exception on INSERT because the DB engine precedes the insertion by a select. How it would check the existence of the same key in the table otherwise? I want to say that the only thing we should do is to override the default DB error handler.
How do I know that the error was caused by some specified constraint violation letting other issues to fail naturally? Should I parse the exception message looking for key_name?
View 5 Replies
View Related
Oct 5, 2007
Hi experts,
What I am trying to do is to open an existing report in a Print Friendly format .
What is the simplest way to do this using Visual Studio?
Here's the sort of thing I hope is feasible:
I can open my Report on a web page , then on that page can be a button / link for the user in case they want to open
that report in a separate window.
So I'd like to jump to that page by jumping to an URL and sending all parameters
something like :
http://Dev_Server/Reports/Pages/Report.aspx?ItemPath=%2fMy+Reports%2fTest+Report&rsaramOne=Parameters!paramOne.value + paramTwo=Parameters!paramTwo.value + etc all other parameters , I have on that report
Any suggestions would be really appreciated .
Regards,TIA
View 3 Replies
View Related
Oct 20, 2007
Hi,I am using sql server 2005 and i am having table with a column which has unique key constraint.So if the user tries to enter the duplicate value for that particular column and try to save it ,it errors out in runtime..how do i raise the user friendly error message in this DB error, when user tries to save it.Thanks
View 9 Replies
View Related
Apr 13, 2008
I just started playing with sqlagent and am finding that viewing a specific message from an ssis step is cumbersome when other entries are also in the log. Exporting seems only able to export all history entries. Viewing right in the log viewer leads to a series of boundary expansions and right scrolls that dont seem convenient for quick identification of a problem in a medium sized ssis message. Right clicking on the message in the viewer seems like it is preparing the message for possible copy but it seems to end there. I'm already familiar with the different levels of verbosity available in the command line. Dont see anything useful on the web.
Is there a user friendly way to copy the contents of a specific message for perhaps pasting to notepad , so that problem identification is facilitated? Is there a not so user friendly way available, one taht doest involve 1st exporting the entire log?
View 7 Replies
View Related
Apr 24, 2015
Is there a way to display a friendly message if a sub-report does not have content ex "No additional products available"...
View 2 Replies
View Related
Sep 28, 2015
I've been quite excited about SQL Server MDS that should allow non-IT staff to easily maintain data. However maintaining data that have many-to-many relationships seems to be quite a pain. I believe the best way is:
Open up your MDS web interfaceGo to entities > product (for example)Add a new member and fill the details Click "product parts" in the bottom right "Related Entities" partAdd a new memberTry and find the product you just created from the dropdownlistSelect the first part and click OKAgain try and find the product you have created from the dropdownlistSelect the second part and click OKRepeat...Close the tab on your browser and finish your product entity.How I wish it worked:
Open up your MDS web interfaceGo to entities > product (for example)Add a new member and fill the detailsCheck a checkbox for each part visible under "product parts" in the bottom right "Related Entities" partFinish your product entity.
View 3 Replies
View Related
Jul 11, 2007
I want to list out the pending transaction for transaction replication by publication.
Help needed.
View 1 Replies
View Related
Apr 9, 2007
Hi all,
I was wondering whether there is a way to show the user an error when the user did not select a specific parameter.
In my case, I have two optional parameters. The user has to select either one to view the report. If the user does not select either one, I would like to show some sort of an error page indicating so. However, all i am getting is a complete blank with no report in sight. I as a developer know this is an error as a result of missing parameters, but i was wondering whether I could produce a page or direct it to a page so that the user doesn't go all horrified at an empty page ?
Thanks
Bernard
View 4 Replies
View Related
Nov 22, 2004
Hi all,
I have two Selects that I want to union into one table:
The first select has this data:
Date | Yes
2004-11-20 | 4
The second select has this data
Date | No
2004-11-20 | 3
When I unioned them I want the data to show as:
Date | Yes | No
2004-11-20 | 4 | 3
I thought that I could make a 'dummy' column for each of the selects, union them and it would work right, but the output I am getting is:
Date | Yes | No
2004-11-20 | 4 | 0
2004-11-20 | 0 | 3
Can someone point me in the right direction?
Thanks,
Mike
View 1 Replies
View Related
Oct 31, 2005
SELECT sysjobs.name, sysjobservers.last_run_outcome, CONVERT(varchar(8), sysjobservers.last_run_date, 112) AS LastRunDate, CONVERT(varchar(8),
sysjobservers.last_run_time, 8) AS LastRunTime, GETDATE() AS CurrentDateTime
FROM sysjobs LEFT OUTER JOIN
sysjobservers ON sysjobs.job_id = sysjobservers.job_id
WHERE (sysjobservers.last_run_outcome = 0) AND (CONVERT(varchar(8), sysjobservers.last_run_date, 112) >= DATEADD(day, - 1, GETDATE()))
I am wanting a similar solution, I need to convert an "int" to a time format, when I use this where ">= DATEADD(minute, - 720, GETDATE())" for the last_run_time I get this error:
Syntax error converting datetime from character string.
View 3 Replies
View Related
Jan 19, 2007
Hi,
I have two tbls joined via a varchar field.. which in tbl I have to use a CASE statement to format it correctly for the JOIN..
All works well.. however, if I add a WHERE clause to the statement, with the WHERE clause affecting only one of the JOINED tbls.. All the NULLS are not shown.
I should get results like:
Postcode Count
tf4 0
tf5 23
tf6 15
tf7 0
etc
Whereas, when I add the where clause, none of the "zeros" are shown, so I get:
tf5 23
tf6 15
Why is this?
Here's the SQL:
SELECT ISNULL(COUNT(CASE LEN(REPLACE(dbo.Customers_Trade.PostCode, ' ', '')) WHEN 5 THEN LEFT(REPLACE(dbo.Customers_Trade.PostCode, ' ', ''), 2)
WHEN 6 THEN LEFT(REPLACE(dbo.Customers_Trade.PostCode, ' ', ''), 3) ELSE LEFT(REPLACE(dbo.Customers_Trade.PostCode, ' ', ''), 4) END), 0)
AS PCCount, dbo.UkPostcodes.Postcode, dbo.UkPostcodes.Town, dbo.UkPostcodes.County, dbo.UkPostcodes.Area, dbo.UkPostcodes.Country,
dbo.UkPostcodes.Master_Account
FROM dbo.UkPostcodes LEFT OUTER JOIN
dbo.Customers_Trade ON dbo.UkPostcodes.Postcode = CASE LEN(REPLACE(dbo.Customers_Trade.PostCode, ' ', ''))
WHEN 5 THEN LEFT(REPLACE(dbo.Customers_Trade.PostCode, ' ', ''), 2) WHEN 6 THEN LEFT(REPLACE(dbo.Customers_Trade.PostCode, ' ', ''), 3)
ELSE LEFT(REPLACE(dbo.Customers_Trade.PostCode, ' ', ''), 4) END
WHERE (dbo.Customers_Trade.TradeCustomerID IN
(SELECT DISTINCT TradeCustomerID
FROM dbo.Orders_Trade
WHERE (DATEDIFF(d, order_date, GETDATE()) < 60))) AND (dbo.Customers_Trade.is_activated <> 'No') OR
(dbo.Customers_Trade.BillingAccountID <> '') AND (dbo.Customers_Trade.BillingAccountID IN
(SELECT DISTINCT TradeCustomerID
FROM dbo.Orders_Trade
WHERE (DATEDIFF(d, order_date, GETDATE()) < 60) AND (is_activated <> 'No')))
GROUP BY dbo.UkPostcodes.Postcode, dbo.UkPostcodes.Town, dbo.UkPostcodes.County, dbo.UkPostcodes.Area, dbo.UkPostcodes.Country,
dbo.Customers_Trade.Master_Account, dbo.UkPostcodes.Master_Account
does not show the nulls:
where as:
SELECT ISNULL(COUNT(CASE LEN(REPLACE(dbo.Customers_Trade.PostCode, ' ', '')) WHEN 5 THEN LEFT(REPLACE(dbo.Customers_Trade.PostCode, ' ', ''), 2)
WHEN 6 THEN LEFT(REPLACE(dbo.Customers_Trade.PostCode, ' ', ''), 3) ELSE LEFT(REPLACE(dbo.Customers_Trade.PostCode, ' ', ''), 4) END), 0)
AS PCCount, dbo.UkPostcodes.Postcode, dbo.UkPostcodes.Town, dbo.UkPostcodes.County, dbo.UkPostcodes.Area, dbo.UkPostcodes.Country,
dbo.UkPostcodes.Master_Account
FROM dbo.UkPostcodes LEFT OUTER JOIN
dbo.Customers_Trade ON dbo.UkPostcodes.Postcode = CASE LEN(REPLACE(dbo.Customers_Trade.PostCode, ' ', ''))
WHEN 5 THEN LEFT(REPLACE(dbo.Customers_Trade.PostCode, ' ', ''), 2) WHEN 6 THEN LEFT(REPLACE(dbo.Customers_Trade.PostCode, ' ', ''), 3)
ELSE LEFT(REPLACE(dbo.Customers_Trade.PostCode, ' ', ''), 4) END
GROUP BY dbo.UkPostcodes.Postcode, dbo.UkPostcodes.Town, dbo.UkPostcodes.County, dbo.UkPostcodes.Area, dbo.UkPostcodes.Country,
dbo.Customers_Trade.Master_Account, dbo.UkPostcodes.Master_Account
View 3 Replies
View Related
Nov 25, 2005
I am using the Server Explorer in VS2005. I have created an additional field in a small test table with 3 other fields. The new field called foo_key does not show up when I query the table ( it has 7 records ).
I have some tables that I'd like to insert an auto-incrementing integer primary key. But at this point I cant figure out what's wrong. I have toggled the field as primary key on and off.It seems if I create a new table, then I see the primary key field and its autoincrementing as desired.
Could it be that I cannot add such a field if my table already has some records ? ...and to get one in would mean rebuilding a new table and shifting the records....pls advise
andrewcw
View 2 Replies
View Related
Mar 29, 2008
Here's my code
View Table 3:
SELECT dbo.VIEW1Client.ID, dbo.VIEW1QA.Score, dbo.VIEW1Client.Score AS Score2, CASE WHEN dbo.VIEW1Client.Score = dbo.VIEW1QA.Score THEN 1 ELSE 0 END) AS Calibrate
FROM dbo.VIEW1QA CROSS JOIN
dbo.VIEW1Client
WHERE dbo.VIEW1Client.ID = '1'
View Table 4: (I created a view table using View Table 3 to get the average and it seems not providig the right average, instead I get 0:
SELECT ID, AVG(Calibrate) AS Perc
FROM dbo.VIEW3
GROUP BY ID
Any Ideas please?
View 4 Replies
View Related
Oct 9, 2007
Hi,
I modified something on the package, saved it and click on build. When i ran the package, it hit an error. when i saw the object that has an error, it was the one i modified. my changes were not applied. i stopped the runtime. and double click again on that package, it reflected my changes. why during runtime it's showing the old version? what's the proper way of saving the package and building it? What's the different of Build and Rebuild?
cherriesh
View 4 Replies
View Related
Jan 18, 2007
Hi,
I have the following query:
SELECT COUNT(dbo.UkPostcodes.Postcode) AS PCCount, dbo.UkPostcodes.Postcode, dbo.UkPostcodes.Town, dbo.UkPostcodes.County,
dbo.UkPostcodes.Area, dbo.UkPostcodes.Country
FROM dbo.UkPostcodes LEFT OUTER JOIN
dbo.Customers_Trade ON dbo.UkPostcodes.Postcode = CASE LEN(REPLACE(dbo.Customers_Trade.PostCode, ' ', ''))
WHEN 5 THEN LEFT(REPLACE(dbo.Customers_Trade.PostCode, ' ', ''), 2) WHEN 6 THEN LEFT(REPLACE(dbo.Customers_Trade.PostCode, ' ', ''), 3)
ELSE LEFT(REPLACE(dbo.Customers_Trade.PostCode, ' ', ''), 4) END
GROUP BY dbo.UkPostcodes.Postcode, dbo.UkPostcodes.Town, dbo.UkPostcodes.County, dbo.UkPostcodes.Area, dbo.UkPostcodes.Country
The query should take all of the UK postcode regions (districts) and then match them up to the postcodes in a customer tbl...
What I'm trying to show is the count for postcode resutls, even the postcodes where there are no customers.
However it won't show any 0 counts - any ideas?
View 4 Replies
View Related
Jan 15, 2007
Hi,
I have two different reports and in these two reports one contains images which is working fine at development site as well as server site but when same report is called from another report using linking facility given in sql report images disappears on server site at development site it is working fine.
Can any one help me out.
Thanks in advance.
Wasim.
View 4 Replies
View Related
Mar 13, 2008
Here is my code. Basically what I am doing is selecting from the database based on the current user. The ReaderResults.Text label is not showing the info pulled from the database, and the ReaderError.Text label is not showing an error. I also tried putting the ReaderResults.Text label inside the loop and that didnt work. Any suggestions?
'Database ConnectionDim con As New SqlConnection("Data Source = .SQLExpress;integrated security=true;attachdbfilename=|DataDirectory|ASPNETDB.mdf;user instance=true")Dim currentUserID
currentUserID = Context.User.Identity.Name.ToString()
Label1.Text = currentUserID
Dim selectSQL As String
selectSQL = "SELECT companyKey FROM Company WHERE UserID = ('" + currentUserID + "')"Dim cmd2 As New SqlCommand(selectSQL, con)
Dim reader As SqlDataReaderDim CompanyKey
Try
con.Open()
reader = cmd2.ExecuteReader()Do While reader.Read()
CompanyKey = reader("CompanyKey").ToString()
Loop
reader.Close()Catch err As Exception
ReaderError.Text = "Error selecting record."
ReaderError.Text &= err.Message
ReaderResults.Text = CompanyKey
Finally
con.Close()
End Try
View 1 Replies
View Related
Mar 13, 2008
The ReaderResults.Text is not returning a value. I am not sure what is going on because the table and all columns are full, Label1.Text shows the current username of the user loggedon, and no error is showing up in ReaderError.Text. Anyone have any ideas?
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'Database ConnectionDim con As New SqlConnection("Data Source = .SQLExpress;integrated security=true;attachdbfilename=|DataDirectory|ASPNETDB.mdf;user instance=true")
'Job1 InfoDim currentUserID
currentUserID = Context.User.Identity.Name.ToString()
Label1.Text = currentUserID
Dim selectSQL1 As String
selectSQL1 = "SELECT companyKey FROM Company WHERE UserID = ('" + currentUserID + "')"Dim cmd1 As New SqlCommand(selectSQL1, con)
Dim reader As SqlDataReaderDim CompanyKey
'Job1 Select
Try
con.Open()
reader = cmd1.ExecuteReader()Do While reader.Read()
CompanyKey = reader("CompanyKey").ToString()
Loop
reader.Close()Catch err As Exception
ReaderError.Text = "Error selecting record."
ReaderError.Text &= err.Message
ReaderResults.Text = CompanyKey
Finally
con.Close()
End Try
View 3 Replies
View Related
Apr 4, 2008
Hi,
We have an internal mail system, but when the user writes something into the textbox (textarea), he often uses enter to get the message over several lines, our problem is that when the message is saved to the database and retrieved, all the breaks are gone and its all on a single line. In the database its stored inside a field called "message nvarchar(MAX)". How can i preserve the linebreaks?
example, user writes:
Hello,Nice day,to go fishing.
output, after it has been saved and retrieved:
Hello, Nice day, to go fishing.
Patrick
View 1 Replies
View Related
Jul 9, 2001
Any idea why I cannot see (in Enterprise Manager) all the coulmns of a selected table? All I get is * all columns - not each one, meaning I cannot select individual columns in my new view. Could it be the version? I am running SQL 7.0 SP1
Thanks
View 2 Replies
View Related
Oct 25, 2000
Hi,
I installed desktop edition of SQL Server7.0 but System databases are not displaying.only showing pubs and northwind only.any body help me.
Thank you
Novah
View 2 Replies
View Related
Nov 13, 2001
I used Query Analyser to De-tach a SQL 7 database and that worked fine. The database became 'invisible' in Enterprise Manager and the entry was removed from the sysdatabases in Master. The mdf and ldf file remain in the file system. However, when I ran the sp to Attach the database QA said successful but it does not show in Enterprise Manager or in sysdatabases in Master. I'm going to run through the procedure again and if problems I'll check the logs but has anyone else had difficulty with this. Also with attaching the db to a SQL2000 install I believe the logins on the SQL7 install are not brought over. In my case, the client is using trusted logins with their database application so their is probably not a lot to manually recreate on the SQL 2000 install but doees anyone have nay sample code/script that can give me an idea of what is required in the area of getting logins out of the Master of SQL7 and into SQL2000.
Great forum...
Have a great day,
ChrisE
View 3 Replies
View Related
Jul 5, 2004
Hello all,
Is there an SQL query that can be run against a database that displays both the number of rows and the physical size of the tables in that database?
I'm basically after the information displayed in Taskpad view >> Table Info, but in an easy to manipulate and publish format.
Thanks for your time.
View 5 Replies
View Related
Mar 13, 2006
My sql server is not showing all of my drives in server. Please help me
View 5 Replies
View Related
Oct 3, 2007
I've added a new drive to a clustered instance of sql 2000. Go to the node the instance is active on, the drive shows up. But...try to add a backup device that lives on the new drive (which was, after all, the whole point of the exercise) and SQL Server is blind to that drive. I have vague recollections of it recognizing the clustered drives when i set up all this a couple years ago. Could it be that it recognizes all the drives it'll ever recognize at the moment of installation? Anybody know?
thanks,
Garth
:beer:
:D :D :D
:beer:
View 6 Replies
View Related
Feb 8, 2008
I want to have all the ethnicities from the Ethnicgroup table to be displayed in a particular area which is in where clause as
aggcourseid
The problem is that even when I have a left join on the EthnicGroup table it will not return all the ethnicities but will only return those who were existing in that particular aggcourseid.
i.e. If there is no African student in E2, it will not show up in the result whereas I want to display all the ethnicities and if there is no record for aggcourseid, it should show up as 0/NULL for that ethnicity.
I have tried all sorts of joins but the problem is whenever I put in the aggcourseid in where clause, it wont bring all the records
declare @mpid char (13)
set @mpid = '011142'
create table #temp_et (
[Year]int NOT NULL,
[Ethnicity] varchar(20),
[Starts]float(4),
[Success]float(4),
[Retention]float(4),
[Achievement]float(4)
)
--Year 05/06
insert into #temp_et
select
CAST(LEFT(pv.pg_expendyrid,2) AS int)[Year],
eg.pg_ethnicgroupname[Ethinicity],
sum([pvstart]) [Starts],
(case when sum(pvstart) = 0 THEN 0 Else convert(decimal(6,3),(sum(pvach)*1.00)/(sum(pvstart)*1.00)*100)end)[Success],
(case when sum(pvstart) = 0 THEN 0 Else convert(decimal(6,3),(sum(pvcomp)*1.00)/(sum(pvstart)*1.00)*100)end)[Retention],
(case when sum(pvstart) = 0 THEN 0 Else convert(decimal(6,3),(sum(pvach)*1.00)/(sum(pvcomp)*1.00)*100)end)[Achievement]
--into temp_et
from [FECAS].Proachieve.dbo.pv_midpoint pv
left join [FECAS].Proachieve.dbo.GN_AggCourseStructure gn on pv.pg_aggcourseid = gn.pg_aggcourseid
left join [FECAS].Proachieve.dbo.PG_ethnicGroup eg on pv.pg_ethnicgroupid = eg.pg_ethnicgroupid
where pv_midpointid = @mpid
and pg_expendyrid = '05/06'
and pv.pg_aggcourseid LIKE 'E2%'
group by
eg.pg_ethnicgroupname,
pv.pg_expendyrid
order by
eg.pg_ethnicgroupname
View 14 Replies
View Related
Feb 9, 2004
I moved a database file (.mdf) from the Microsoft SQL Server data directory to another location, and moved it back into the original location. After which the database staus changed to suspect.
How do I make it live? Thanks
View 1 Replies
View Related
May 11, 2015
We have nightly job running to reorg all in one of our prod database. But the index on one of the table fragmenting quickly by the morning showing 90% fragmentation.
View 9 Replies
View Related