|
hi....
Now displaying date like 10-2007 but I want to display Oct-2007.in Sql Query..anybody know plz reply me..
Rajendran
|
|
|
|
|
Try This,
select convert(varchar(50),getdate(),106)
|
|
|
|
|
hi soni Uma....Thanks for reply.....
I want to display only the month and year..(Oct-2007) if u know that plz reply me..
see the following code...thats i have used...but its displaying 10-2007....
select Cast(DatePart(month,RenewalBaseMonth) as varchar) + '/' +Cast(DatePart(year,RenewalBaseMonth) as varchar) as RenewalBaseMonth
from #temp21
Thanks
Rajendran
|
|
|
|
|
Hi,
Try this
select Cast(DateName(month,RenewalBaseMonth) as varchar(3)) + '/' +Cast(DatePart(year,RenewalBaseMonth) as varchar) as RenewalBaseMonth
from #temp21
Senthil
-- modified at 8:15 Tuesday 30th October, 2007
|
|
|
|
|
hi,
Its working fine....
Really good work and thanks alot....
Rajendran
|
|
|
|
|
Pls rate my answer if it is working well
Senthil
|
|
|
|
|
May I know where u r working..If u feel good tell me.
Thanks..
Rajendran
|
|
|
|
|
Hi Rajendran,
I am working in Pricol Ltd, Coimbatore as Dev lead.
How about u?
Senthil
|
|
|
|
|
Senu Gandhi wrote: Pls rate my answer if it is working well
It is rude to solicit votes.
|
|
|
|
|
|
R a jendran wrote: already I voted for u...5/5
y u r saying like this..really good work..
I can't even read that. Can you stick to English please.
|
|
|
|
|
sorry ....i was read that hidden part thats Y replied again....i 'll correct it..
thanks
Rajendran
|
|
|
|
|
R a jendran wrote: Y
That is the penutimate letter of the modern English alphabet. It is not a word per se.
|
|
|
|
|
Ok
This is work fine
select DATENAME(MONTH,GETDATE()) + '/' + Cast(DatePart(year,getdate()) as varchar)
Have nice time
|
|
|
|
|
Thanks for reply...already senu gandhi sent me that solution...I solved that problem ...
Thanks..
Rajendran
|
|
|
|
|
Hi,
I have a problem with a sql-Statement. I’m developing an application in which a user can type in a sql-statement, e.g. "Select * from (select name from employee)" . This statement is not very reasonable but it is syntactically correct.
My code is
OracleCommand cmd = new OracleCommand("Select * from (select name from employee)", myOracleConnection);
OracleDataReader rdr = cmd.ExecuteReader(CommandBehavior.KeyInfo);
System.Data.DataTable colinfo = rdr.GetSchemaTable();
At this staement the application crashed with an exception: "InvalidOperationException: Identifier expected or identifier in quotes expected" . (The message is in germaan: "Syntaxfehler: Erwartet wird ein Bezeichner bzw. Bezeichner in Anführungszeichen.", but i try to tranlate it in english)
I want to use GetSchemaTable to get all the columninformation I needed to display the result. So how can I solve the problem ?
Thanks in advances
Willibert
|
|
|
|
|
Does it work if you specify a table alias:
Select * from (select name from employee) a
That should make the SQL legal.
|
|
|
|
|
Hi,
Select * from (select name from employee) is a legal statement, OracleClient and Toad could execute it.
I could by-pass it, I change
OracleDataReader rdr = cmd.ExecuteReader(CommandBehavior.KeyInfo);
into
OracleDataReader rdr = cmd.ExecuteReader(CommandBehavior.SchemaOnly);
But their I don't get the basistablename even in a normal select.
Tanks
Willibert
|
|
|
|
|
Hi
My requirement is i hve 4 tables
Specmast(specification,wgt,min)
specgen(specification,wgt,min)
specem(specification,wgt,min,em)
specdes(specification,wgt,min,desg).
All the specification i hve stored in the first table. Now what i want is in specgen i hve to get those specification details from specmast which are not in specem and specdes. How can i give query for this
Pls help me this is very important
Thanks in advance
Regards
Micydon
|
|
|
|
|
Select * from Specmast where specification not in(select specification from specem,specdes)
u will try this query....
Rajendran
|
|
|
|
|
Micydon ,
Select specification,wgt,min
from Specmast
Where specification not in (Select e.specification
from specem e Inner join specdes d on
e.specification = d.specification )
This will work
Senthil
|
|
|
|
|
I am working on .Net 2.0 and SQL 2000.
While running my application, during dataset fill I get the following error
"Timeout expired. The timeout period elapsed prior to completion of the operation or the server is not responding"
I tried setting connection timeout to 0 and command timeout to 0.
This is the code:
public DataSet FillDatasetSQL(string strQuery)
{
try
{
//-----Connection open
sqlConn = new SqlConnection(strSqlConn);
sqlConn.Open();
//-----Fill Dataset
DataSet ds = new DataSet();
sqlAdap = new SqlDataAdapter(strQuery, sqlConn);
sqlAdap.Fill(ds, "Tablename"); <=========== error occurs here
//-----Connection close
sqlConn.Close();
sqlConn.Dispose();
return ds;
}
catch(Exception ex)
{
if (sqlConn.State == ConnectionState.Open) sqlConn.Close(); sqlConn.Dispose();
throw ex;
}
}
Please help
Senthil
|
|
|
|
|
How and where did you try set the command timeout?
Did you try set it in the connection string or did you do something like:
sqlAdap = new SqlDataAdapter(strQuery, sqlConn);<br />
sqlAdap.SelectCommand.CommandTimeout = 120;<br />
sqlAdap.Fill(ds, "Tablename");
Dad always thought laughter was the best medicine, which I guess is why several of us died of tuberculosis.
I can picture in my mind a world without war, a world without hate. And I can picture us attacking that world, because they'd never expect it.
|
|
|
|
|
Thanks for your reply.
You are right. I too tried the same what u said.
But it doesn't work out well.
Senthil
|
|
|
|
|
How much data are you trying to bring back?
It might be that the sql statement is running fine but it's timing out trying to fill the dataset.
If you run the SQL statement in Query Analyser or Management Studio, how many rows do you get back and how big (data wise) are the rows?
Dad always thought laughter was the best medicine, which I guess is why several of us died of tuberculosis.
I can picture in my mind a world without war, a world without hate. And I can picture us attacking that world, because they'd never expect it.
|
|
|
|