|
While saving the time from another time zone, just save value returned by GetDate function. It gives current time in the current timezone. In case you are looking for GMT times, use GetUtcDate function.
|
|
|
|
|
Yes thats right. But I dont want to store the current time. I need to use the time provided by the exchange. Thats why I was thinking what to do
Thank you nish.
|
|
|
|
|
in my table i am entering values like A/101/2010,A/102/2010.......A/1000/2010
after this value when i use MAx() function which return me A/999/2010
now i need the query which should return this value 'A/1000/2010' and on words plz help me out.....
|
|
|
|
|
You should write an user defined function for your issue because the values which you are storing are not number data type. Also you need to sort the records based on year which is last 4 chars in your sample value. So write an UDF.
|
|
|
|
|
Nikhil Bhivgade wrote: A/101/2010
That looks like three values to me. How about splitting them over different columns? That way you could easily SORT the values any way you'd want
I are Troll
|
|
|
|
|
Hi All !
I create a Query Form from a table in MS Access. in this form i Create 2 TextBoxes an a Button for Fliter Data. I want to Filter Data , when a user inpute dates in the TextBoxes .
what's the code of filter in VBA?
thanks
|
|
|
|
|
I hope you did not wait for an answer - a simple search [^]would have given you many answers
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Can anyone with any more DB experience than me, please suggest ANY reason this doesn't work... its driving me mad!
So, the in my UI the user can create an "assembly" by adding "components" to a list. I have an assembly table that links the ID of the assembly with the IDs of its constituent components, and the quantity of each component in the assembly.
Users now want to be able to create a new assembly based on an old one, so I need a copy function. Easy I though, I'll just crib the code from the single-component-add function and loop around it...
HA!
I end up with the new assembly item, but I lose the component list. The code below just creates the requisite number of blank (0, 0, 0) records in the Assembly table, but it all looks right in the debugger. Why?
if (m_pMainGrid->m_bCopyingAssembly)
{
CDaoDatabase* pDB = GetDatabase();
CString Filter;
CAssemRecords* OldAssRS = new CAssemRecords(pDB);
CAssemRecords* NewAssRS = new CAssemRecords(pDB);
try
{
Filter.Format("SELECT * FROM Assemblies WHERE [Assembly Key] = %ld", lOldComponentKey);
OldAssRS->Open(dbOpenDynaset, Filter, 0);
NewAssRS->Open(dbOpenDynaset, "SELECT * FROM Assemblies", 0);
if (!(OldAssRS->IsBOF() || OldAssRS->IsEOF()))
{
OldAssRS->MoveFirst();
do
{
NewAssRS->AddNew();
NewAssRS->Initialise();
NewAssRS->m_Assembly_Key = lNewComponentKey;
NewAssRS->m_Item_Key = OldAssRS->m_Item_Key;
NewAssRS->m_Number_Length = OldAssRS->m_Number_Length;
NewAssRS->Update();
OldAssRS->MoveNext();
} while (!OldAssRS->IsEOF());
}
ASSERT(OldAssRS->IsOpen());
if (OldAssRS->IsOpen())
{
OldAssRS->Close();
}
if (OldAssRS)
{
delete OldAssRS;
}
OldAssRS = NULL;
ASSERT(NewAssRS->IsOpen());
if (NewAssRS->IsOpen())
{
NewAssRS->Close();
}
if (NewAssRS)
{
delete NewAssRS;
}
NewAssRS = NULL;
m_pMainGrid->SetCopyingAssem(FALSE);
}
catch(CDaoException *e)
{
ASSERT(e->ReportError());
e->Delete();
OldAssRS->Close();
NewAssRS->Close();
return;
}
catch(CMemoryException *e)
{
e->Delete();
OldAssRS->Close();
NewAssRS->Close();
return;
}
}
|
|
|
|
|
Not being familiar with CDO and recordset operations I will give you the pseudo code that I would use
copy the assembly record into variables/object
insert the variables/object into a new record
save the record and get the new assembyid
get a list of the old assembly components
loop through component list
copy component details into variables/object
save the component with the new assemblyid
repeat for each assembly
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
As it turns out, in my RecordSet class m_bCheckCacheForDirtyFields was set to FALSE. This turns off automatic double buffering and means you have to manually set fields dirty, otherwise they won't save when you call Update.
Blah. Flip the switch and it works...
|
|
|
|
|
hi guys
is there any way to convert sql2005 database objects to sqlserver 2008 objects?
show me how?
|
|
|
|
|
SQL 2008 comes with a "Copy Database Wizard" you can make use of that to move your database from SQL 2005 to SQL 2008.
|
|
|
|
|
Restore or attach the 2005 database to your sql2008 server and change the compatibility level.
Just what are you expecting to change when you move to 2008?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
How's this for weird?
One of my co-workers was attempting to develop an update trigger for an application that is developed using power-builder and (as far as I can tell) communicates to the database through a Sybase layer. The application is talking to a SQL Server 2005 server with a database set to SQL Server 2000 compatibility level.
In the trigger, he is inserting into a table variable and running some logic based on that. The entire trigger runs just fine through all test cases in the DB; however it fails when the update is called from the application. With the error: Row changed between retrieve and update. Not having access to the application source, we couldn't debug very much through the app and Google was not our friend.
Through debugging the trigger, we found the insert statement to be the culprit, but only when it insert 0 records into the table variable(we knew the logic below the trigger to be irrelevant as it was commented out).
Being curious about the error message, I went ahead and printed @@error before and after the insert; then tested through Management Studio. I received no errors. Still curious, we ran the update through the app. We encountered no errors here either. Eventually we found that printing anything before the insert resolved the issue. In an attempt to figure out the problem, I even tried PRINT char(13)+'(0 row(s) affected)' . It ran with no problem through the app.
Happy to be rid of the error, my colleague continued his development; but we're still wondering: "WTF?"
What do you guys think? Shall we chalk it up to Sybase oddities or is there a reasonable explanation for this?
modified on Friday, August 27, 2010 9:47 PM
|
|
|
|
|
WTF, who was the evil bastard who architected this abomination. With so many competing and disparate layers you are going to get insane problems like this one! When it come down to the point where the solution is based on a print statement I would want nothing to do with it. run away, run away very fast
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
LOL! I've been saying the same thing for three years. Either I'll convince someone that we need to write our own application to replace this one, or hope the vendor moves away from this model.
|
|
|
|
|
Hello !
i try to use the command
DoCmd.OutputTo acOutputReport, RptName, "SnapshotFormat(*.snp)", _
strPathandFileName
Works just fine. I want this process to be automatic and hidden from the user, but a window pops up with a "Cancel" button. I don't want to allow the user the cancel option, and I'd prefer to have that pop-up window be invisible. Can I do either of these things:
1. Prevent that window from popping up (or make it invisible)
in lieu of that,
2. Change that popup window to have no Cancel button.
Help me !
Thank you in advance.
|
|
|
|
|
|
Thank you !
I try this but doesn't work.
|
|
|
|
|
The Office Suite is meant for interactive use, and will pop up all kinds of dialogs when it sees fit. AFAIK there isn't much you can do about that.
Of course you don't need the Access application, you could create your own app (with GUI and business logic) and use OLEDB and an access database file as the data store. That won't pop up anything you didn't design.
|
|
|
|
|
I have created a sp
in which i have used @@rowcount with while but it is not working
e.g
Select * from #temp
print @@rowcount
while @@rowcount <> 0
begin
----
----
---
end
the print command is giving rowcount 1 but still it is not working
One person's data is another person's program.
--J.Walia
|
|
|
|
|
Remove that print @@rowcount
or declare a variable and set the @@rowcount into that variable and use that variable further.
DECLARE @rc AS INTEGER
Select * from #temp
SET @rc = @@rowcount
print @rc
while @rc <> 0
begin
----
----
---
end
|
|
|
|
|
This is because the @@ values get reset when an action (print) executes.
|
|
|
|
|
I am in great confusion. I wrote a sql function to find the day of week.My query is shown below:
ALTER FUNCTION dbo.udf_DayOfWeek
(@dtDate datetime)
RETURNS VARCHAR(10)
AS
BEGIN
DECLARE @rtDayofWeek VARCHAR(10)
SELECT @rtDayofWeek = CASE DATEPART(weekday,@dtDate)
WHEN 1 THEN 'Sunday'
WHEN 2 THEN 'Monday'
WHEN 3 THEN 'Tuesday'
WHEN 4 THEN 'Wednesday'
WHEN 5 THEN 'Thursday'
WHEN 6 THEN 'Friday'
WHEN 7 THEN 'Saturday'
END
RETURN (@rtDayofWeek)
END
GO
Call this function like this:
SELECT dbo.udf_DayOfWeek('8/27/2010') AS DayOfWeek
But I have to get output when fromdate and todate is given.ie:When fromdate='8/25/2010' and todate='8/27/2010',then the output is wednesday,Thursday,Friday..How to wrie sql function for this.Please modify the above code..Hope u will understand my problem
Thanks in advance
|
|
|
|
|
So change your function to take 2 dates and return a table
In your function create a table variable with 1 or 2 fields (date and DoW)
insert the dates and calc the DoW
return the table to the procedure
You can then do a join between the date passed in abd the date in the result set.
Never underestimate the power of human stupidity
RAH
|
|
|
|