|
One of the first places I referenced.
That example works as the Div by 0 only returns one error message and ERROR_MESSAGE() returns the last error message. But when an error occurs on a Add/Drop table constraint 2 errors occur, and I'm interested in the first message and not the last!
|
|
|
|
|
Hi
I have a table named StudentResult
UserID School Semester Grade Campus Status
1 School1 Summer 10 Campus1 Accepted
2 School1 Summer 10 Campus1 Accepted
3 School1 Summer 10 Campus1 Rejected
4 School1 Summer 10 Campus1 Rejected
5 School1 FALL 10 Campus1 Accepted
6 School1 Summer 12 Campus1 Accepted
7 School1 Summer 12 Campus1 Rejected
8 School1 Summer 12 Campus1 Accepted
9 School1 Summer 12 Campus1 Rejected
10 School1 Summer 12 Campus1 Accepted
11 School1 FALL 12 Campus1 Rejected
12 School1 FALL 12 Campus1 Accepted
13 School1 FALL 11 Campus1 Rejected
14 School1 FALL 11 Campus1 Accepted
15 School1 FALL 11 Campus1 Accepted
16 School1 Summer 11 Campus1 Rejected
17 School1 Summer 11 Campus1 Accepted
18 School1 Summer 11 Campus1 Accepted
I want to take the number of accepted and rejected users from the above table as the result table below.I want to consider grade,Campus and semester for taking count and the result should be like result table.Please help me to write Query for this.
I am using SQL server2000. as database
School Semester Grade Campus NoofAccepted NoofRejected
School1 Summer 10 Campus1 2 2
School1 Fall 10 Campus1 1 0
School1 Summer 11 Campus1 2 1
School1 Fall 11 Campus1 2 1
School1 Summer 12 Campus1 3 2
School1 Fall 12 Campus1 1 1
Thanx
|
|
|
|
|
select School, Semester, Grade, Campus,
sum(CASE WHEN Status = 'Accepted' THEN 1 ELSE 0 END) AS NumOfAccepted,
sum(CASE WHEN Status = 'Rejected' THEN 1 ELSE 0 END) AS NumOfRejected
from StudentResult
group by School, Semester, Grade, Campus
Of course, this is what you have asked for, but not necessarily the best way of going about it... you could always just use count (*) and use the Status as a Column heading also...
-------------------------------------------
Don't walk in front of me, I may not follow;
Don't walk behind me, I may not lead;
Just bugger off and leave me alone!!
|
|
|
|
|
hihi,i'm new baby in sql.So, I would like ask someone can help me solve a question as posted as below.
1. As a admin, i need to know who is connecting to my sql database.But,I have no idea to get the method to detect who is connecting to my sql database
thank for your help
|
|
|
|
|
Running sp_who2 will give necessary details
|
|
|
|
|
thank for your helping.
But, can you explain more detail about 'sp_who2'.
I really have no idea to 'sp_who2'.
Thank again
|
|
|
|
|
|
select [name] from sysusers where [name] <> 'dbo' and islogin = 1
Regards - J O H N -
|
|
|
|
|
thank for help.I can solve my problem.thank again.
|
|
|
|
|
I want to update table, with this following code:
declare @parentid int<br />
select accountparentid=@parentid from account where accountid=@accountid<br />
<br />
while @parentid<> 0<br />
begin<br />
UPDATE [dbo].[account]<br />
SET [accountvalue] = [accountvalue]+@accountvalue<br />
where accountid=@parentid<br />
select accountparentid=@parentid from account where accountid=@parentid<br />
END
How do I create the function in SQL with the name UpdateAccountParent, I'm using C# express. This should be easy. Thanks.
|
|
|
|
|
consult MSDN[^]
Tirtha
Do not go where the path may lead, go instead where there is no path and leave a trail.
Author: Ralph Waldo Emerson (1803-82), American writer, philosopher, poet, essayist
|
|
|
|
|
Hi My name is Lee Hatcher and I am a newbie to Access and sql. This has probally already been asked but I am trying to create round control buttons for them. Any help will be appreciated.
Thanks,
Lee
|
|
|
|
|
Round buttons for sql??
What are you doing?
|
|
|
|
|
Patty
Thanks for the response. I have created a database for a company in sql with an access front end and would like round control buttons instead of squares and rectangles. It is not necessary but I would like some personal touches to it.
Thanks
Lee
|
|
|
|
|
Good luck customising an access front end. If it's not necessary, then i'd just save yourself a lot of pain and heartache and deploy it... If they want a pretty front end, make them pay you for it and do it in using decent tools...
|
|
|
|
|
Thanks again Paddy,
Ok what would you suggest for a front end VB?
Thanks
Lee
|
|
|
|
|
I am executing a DTSX from a VB.Net application. Problem is that when I built the DTSX to do importing of the flat files, it has hardcoded the locations of the Flatfiles. I want to be able to set a variable for the file's location and pass that variable in the vb coding. HOW CAN I SETUP THE FILE LOCATIONS TO BE VARIABLES PASSED IN? How do I pass it in?
'Here we import the files from the file location into Loader's tables
Dim app As New Application()
Dim vars As Variables
Dim AppPath As String
AppPath = My.Application.Info.DirectoryPath
Dim package As Package = app.LoadPackage(AppPath & "\AutoLoaderPkg.dtsx", Nothing)
vars = package.Variables
vars("fileLocation").Value = gsFileLocale
Dim result As DTSExecResult = package.Execute()
If result = DTSExecResult.Success Then
FileImport = True
Else
FileImport = False
End If
|
|
|
|
|
Does anybody know if I can run SQL query in A2T Application? and How? Thanks.
Jane
|
|
|
|
|
Pardon my ignorance, but what's an "A2T application?"
|
|
|
|
|
I'm trying to install the SQL 2008 VHDs from MSDN on WinXP MC running Virtual PC 2007. But it asks me for the archive "en_sql_server_2008_ctp_4_vhd_part_1_of_5_.rar", which doesn't exist on MDSN subscriber downloads. Has anyone else had trouble installing this? I googled the file name and there's only one post out there, with no response.
|
|
|
|
|
Yes, somehow they've mangled it. When it asks for each file, just give it the next part in sequence:
part_1_of_5.rar -> part_2_of_4.rar
part_2_of_5.rar -> part_3_of_4.rar
part_3_of_5.rar -> part_4_of_4.rar
Presumably they've used a self-extracting executable because a .vhd is generally very compressible and it shaves a lot off the download time. I can't recall if the MSDN downloader uses the Attachment Security stuff added in XP SP2 to give the download the 'mark of the web'. If it does, one reason for carving it into pieces might be to save having to check all 2GB of the file for a signature when you run the first piece.
They can't make it a standalone ZIP because the file's bigger than 4GB and the built-in 'Compressed Folders' in Windows XP and Server 2003 can't handle the ZIP64 extensions to get around the 4GB file limit.
DoEvents : Generating unexpected recursion since 1991
|
|
|
|
|
|
I downloaded this from MSDN[^] earlier today and it worked fine. Did you get another version or from a different location?
The file may have been corrupted.
Take care,
Tom
-----------------------------------------------
Check out my blog at http://tjoe.wordpress.com
|
|
|
|
|
The version on MSDN Subscriber Downloads has the problem mentioned.
DoEvents : Generating unexpected recursion since 1991
|
|
|
|
|
Hi Guys,
Is it possible to restore a backup of SQL Server 2005 Enterprise/Standard Edition onto a SQL Server 2005 Express Edition DB.
I have a small backup file. its really small. Can someone just restore the backup for me and generate an SQL script from it. I need the script. I'll be lost without it.
Thanks in advance everyone.
|
|
|
|