|
For SQL-Server:
select Name, Rank from MyTable
order by case when Rank = 0 then 'B' else 'A' end, Name Other databases allow similar techniques.
Regards
Andy
|
|
|
|
|
Hi Ashish,
Use the below code,
create table temp#
(
assessmentid int,
appid int
)
insert into temp# select name,rank from table where rank <> 0 order by rank asc
insert into temp# select name,rank from table where rank = 0 order by name asc
select * from temp#
This will give you the output.
Regards,
Sarayu
|
|
|
|
|
Hi All
I have developed an application in which I use SQL Express 2005
All of my reports in the application are linked to database via instance name [MachineName]\OPMS
Now I want his SQL Express 2005, so that while deployment of the application, SQL Express 2005 create an instance name "OPMS" instead of SQLExpress which is infact default instance name.
Can any one please help me because I am in trouble
Regards
Muhammad Sharjeel Ahsan
|
|
|
|
|
First of all, do not hard code connection string. Secondly, you can install another version of SQLExpress with a different instance name.
Farhan Noor Qureshi
|
|
|
|
|
The connection string is no hard coded, I have placed connection string in App.Config so that user may change that string after deployment, but the problem is that Crystal report hard code the instance name of database
E.g. .\SQL2005
After deployment and during running of the application, crytal report search for that "SQL2005" So I want the SQL Express to have a user defined instance name which I first assign to All of report (under push or pull process) and then define that insance name to somewhere so that during installation of my application, tha instance name created while insallation of SQL Express, Please note that default insance name is SQLExpress but I do not need that name at all.
More over, if I install SQL Express directly then it asks for instance name but while installing as a pre requisite, it create SQLExpress.
Please reply asap
Regards
|
|
|
|
|
Hi,
I have deleted 100 rows from a SQL Database.I haven't database backup.
Is there a way to recover the DB?
Thanks in advance.
|
|
|
|
|
If you haven't got a backup of your database to restore from, you're not going to be able to retrieve your lost data.
Perhaps this will teach you the importance of taking regular backups of your database...
Paul Marfleet
|
|
|
|
|
hi everyone
plz tell me how to convert an MySQL *.sql file (CREATE TABLEs, INSERTs) to an MsSQL *.sql file, recommend software or something...
Tenx
|
|
|
|
|
Google?[^]
I've personally not used MySQL (thank god) so I've never needed to do any converstions. If it's just straight SQL then it shouldn't need converting.
|
|
|
|
|
The appropritate place for your post is the jobs board[^]
Jerry0288 wrote: Include city/state of location
City: Glasgow
State of location: Needs a bit of a clean.
|
|
|
|
|
Hi.,
I want to get a record from MS Access where a datetime field is equal to a C# DateTime type's ToShortDateString(), for example,
DateTime myTime = DateTime.Now;
string query = "SELECT * FROM myTable WHERE [date] = '" + myTime.ToShortDateString() + "'";
Now, is it correct syntax or do I need any Convert function in JET SQL ?
Is it correct to compare with C# DateTime's ToShortDateString() formatted value with JET SQL Date type field ?
I want to compare only the Date part, no Time stamp. I want to get all records for the same date I query. But if it compares also with the time part, then In fact I will not get any record in return because it is not useful to get a records for a particular second.
Would you please help me.
Thanks.
|
|
|
|
|
Need a method to call a web service from SQL passing the web service billing info and receiving back the results of the charges in xml. Its a asp page with a CustomerID and Amount parameter and returns xml for success or fail
Example
http://CreditCardSvr/processes/chargecard.aspx?customer_id=1022&amount=5.75
Response
|
|
|
|
|
Hello Everybody
I developed a console app that imports CSVs files to DataBase.
Well, I need that app runs each 2 min, then I used SQL Server Agent to create a job to do that.
But when my app raise a exception, the job can't recognize this error and enter in continuous process (looping). So the job can't execute next schedule.
When app runs successful, the ExitCode == 0.
See code below
try
{
.... code
Environment.ExitCode = 0;
}
catch(Exception e)
{
Environment.ExitCode = -1;
process.Kill();
}
finally
{
process.Close();
}
|
|
|
|
|
Have you tried out SSIS. It's pretty simple to use and you can send rows from your csv file that cause insert errors to an error file. See http://www.mridey.com/blog/Lists/Posts/Post.aspx?List=321eab0d%2De4d2%2D4523%2D914e%2D128a6688109f&ID=7
|
|
|
|
|
Hi
I have 3 tables in my database. Students , SessionTable and Campus.
Table campus have two fields
CampusId and CampusName
and SessionTable have two fields
SessionId and Sessioname
and the tble student have12 fields
they are
studentId,Name,DOB,Grade,Phone,City, campus1,Session1, campus2,Session2, campus3,Session3
I want tao take all the rows of following fields from tables
STUDENTNAME,STUDENTID,DOB,GRADE,PHONE,CITY,Campus.CAMPUSNAME AS CAMPUS1,SessionTable.SESSIONNAME AS SESSION1,CAMPUS.CAMPUSNAME AS CAMPUS2,SessionTable.SESSIONNAME AS SESSION2,CAMPUS.CAMPUSNAME AS CAMPUS3,SessionTable.SESSIONNAME AS SESSION3
I wrote a query like this . But does not takes all the rows from Database
SELECT Students.StudentID, CampusList_1.Name As Campus1, CampusList_2.Name As Campus2 , CampusList_3.Name As Campus3, Students.Session1,Students.Session2,Students.Session3,Students.StudentName as FirstName,Students.StudentLastName as LastName, Students.DateOfBirth, Students.Street,Students.AppartmentNo,Students.City, Students.State, Students.ZipCode, Students.Phone, Students.ParentFirstName, Students.ParentLastName, Students.SSN, Students.SchoolYear, Students.Semester, iif(Students.Sibling,'Yes','No')as Sibling,iif(Students.Accepted,'Yes','No')as Accepted,iif(Students.Waitlisted,'Yes','No')As Waitlisted ,Students.ApplicationDate,Students.CurrentSchool,Students.AltenatePhone From ((( Students LEFT JOIN CampusList AS CampusList_1 ON Students.Campus1 = CampusList_1.CampusID) LEFT JOIN CampusList AS CampusList_2 ON Students.Campus2 = CampusList_2.CampusID) LEFT JOIN CampusList AS CampusList_3 ON Students.Campus3 = CampusList_3.CampusID )LEFT JOIN SessionTable ON SessionTable.SessionId=Students.Session1 LEFT JOIN SessionTable ON SessionTable.SessionId=Students.Session2 LEFT JOIN SessionTable ON SessionTable.SessionId=Students.Session3
Pls help me on this issue..........
|
|
|
|
|
Try:
SELECT Students.StudentID, CampusList_1.Name As Campus1,
CampusList_2.Name As Campus2, CampusList_3.Name As Campus3,
Students.Session1, Students.Session2, Students.Session3,
Students.StudentName as FirstName,
Students.StudentLastName as LastName,
Students.DateOfBirth, Students.Street, Students.AppartmentNo,
Students.City, Students.State, Students.ZipCode, Students.Phone,
Students.ParentFirstName, Students.ParentLastName, Students.SSN,
Students.SchoolYear, Students.Semester,
iif(Students.Sibling, 'Yes', 'No') as Sibling,
iif(Students.Accepted, 'Yes', 'No') as Accepted,
iif(Students.Waitlisted, 'Yes', 'No') As Waitlisted,
Students.ApplicationDate, Students.CurrentSchool,
Students.AltenatePhone
FROM Students
LEFT JOIN CampusList AS CampusList_1
ON Students.Campus1 = CampusList_1.CampusID
LEFT JOIN CampusList AS CampusList_2
ON Students.Campus2 = CampusList_2.CampusID
LEFT JOIN CampusList AS CampusList_3
ON Students.Campus3 = CampusList_3.CampusID
LEFT JOIN SessionTable AS Session_1
ON Session_1.SessionId = Students.Session1
LEFT JOIN SessionTable AS Session_2
ON Session_2.SessionId = Students.Session2
LEFT JOIN SessionTable AS Session_3
ON Session_3.SessionId = Students.Session3
ORDER BY Students.StudentID
|
|
|
|
|
Hi all,
I am developing an windows application using .net. In that i am gettting data's from two database, how to write connection string to these databases commenly? also how to get data using an single query from those two database.
For Eg:
database1:
select id,name from table1;
database2
select id,name from table2;
Both the tables have same fields but diff table and diff database.
Plz any one suggest me how to write as single query.
Thanks in advance
Know is Drop, Unknown is Ocean
|
|
|
|
|
Example:
SELECT field1, field2 FROM mydatabase.dbo.table inner join myotherdatabase.dbo.table2 on field3 = field4 .The parts before the .dbo refer to the two databases.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Hi,
Thankyou very much for your kind suggestion.
Know is Drop, Unknown is Ocean
|
|
|
|
|
No problem.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
u can use union,since both table has same structure
|
|
|
|
|
Shyam.r wrote: u can use union,since both table has same structure
Eh? What on earth are you blathering on about? Union? He wanted to know how to link together two tables in different databases.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Well, no, he wanted to write one connection string to two databases. He wasn't clear on what he wanted to do with it. Or even what the two database systems are. I would have asked for more information, but as he's satisfied with the answers so far, I won't bother.
|
|
|
|
|
Actually, he was clear - he stated that he also wanted to get the data with a single query.
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
Exelioindia wrote: how to write connection string to these databases commenly?
If both databases exist on the same SQL Server then just use the connection string to either one. NOTE: The login will have to be associated to a user on each database with sufficient right to perform the actions you want to perform.
Exelioindia wrote: also how to get data using an single query from those two database.
When you reference a table you can use a fully, or partially qualified name.
The full naming convention is:
[server].[database].[schema].[table]
You can ingore the server part.
|
|
|
|
|