|
Not very. The trigger is fired when the file is created, not when it is closed, so he will still have the same problem.
- I would love to change the world, but they won’t give me the source code.
|
|
|
|
|
He can use a FileSystemWatcher for this.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
I ran into a similar problem years ago with DOS. I wrote the realtime code for a sucker rod inspection system. Basically the rods move through the detectors at 1 ft/second. I had to take the readings, do some filtering and spot flaws, then send a signal to a paint gun when the flaw passed by the paint gun. Still audir record was required, so I needed to save all of the measurements and filtered results to the hard disk, without missing any days passing by at 1 ft/sec. I made an end of rod detectotion routine and "vomited all the data to the hard disk in between rods. The trick was to tell when the hard disk write was completed to begin searching for the start of the next rod. In DOS it wasn't too hard, but I don't recall how I did it.
CQ de W5ALT
Walt Fair, Jr., P. E.
Comport Computing
Specializing in Technical Engineering Software
|
|
|
|
|
We were sitting around talking about the max possible datetime in SQL server, and the fact that you have to know what it is before you can use it.
I mentioned that .Net types all have a MaxValue property, and one of the DBAs said there was nothing like that in SQL server - "you have to know the value".
I mentioned that we like to avoid using "magic numbers", and asked if SQL Server allowed you to specify common values accessible by all databases on the server, something like this:
DECLARE @@SqlDateTimeMaxValue DATETIME = '9999-12-31 23:59:59.997'
...and was again told that SQL didn't have anything like that.
SQL Server - Welcome to the 80's...
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Why would it need one? You can always check validity with TRY_PARSE() or TRY_CONVERT().
Whenever you find yourself on the side of the majority, it is time to pause and reflect. - Mark Twain
|
|
|
|
|
We need to set a datetime column with the max datetime value. Using magic numbers to do this is just as much a bad idea as it is in .net.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
By using maximum/minimum dates to mean something like "not yet happened" or "not yet known", you are using magic numbers however you look at it - regardless of whether said magic number can be represented by a constant.
Either use a NULL or preferably normalise the database to the point where the appropriate date field either exists or it doesn't.
Whenever you find yourself on the side of the majority, it is time to pause and reflect. - Mark Twain
|
|
|
|
|
In our case, it's "never will happen", and it can't be a null column (so we can't use NULL). The original code was using a date 20 years in the future that was calculated from the current date (so ALL of the valuers in this column are different). FYI, the original code was done in 2012, long before I started working here.
If you use a MaxValue property, it will always be valid, even if that value changes in the host system, (kinda like int and long changing sizes when a new higher-bit OS is introduced). If you're using what the system is telling you what the value is, you're better off. Given that SQL doesn't have a built-in MaxDateTime function, I was hoping for athe ability to set a globally accessible variable. Admittedly, that would result in having to use a "magic number" to set the variable, but at least we could have simply referenced a pre-specified variable instead of having to sprinkle the code with SET @maxDateTime DATETIME='9999-12-31' .
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
It does sound like your predecessors need shooting, rather than Microsoft!
Whenever you find yourself on the side of the majority, it is time to pause and reflect. - Mark Twain
|
|
|
|
|
You can always write a CLR stored procedure and return SqlDateTime.MaxValue from it.
"It is easy to decipher extraterrestrial signals after deciphering Javascript and VB6 themselves.", ISanti[ ^]
|
|
|
|
|
We don't do CLR stuff in our database if we can avoid it.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
This guy wrote some code to find it: Max Date Value[^]
Quote: This took 7 seconds to run on my machine, fyi.
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
#realJSOP wrote: you have to know what it is before you can use it.
If only it was documented somewhere[^]!
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
That's not the point.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Why "something like" this:
DECLARE @@SqlDateTimeMaxValue DATETIME = '9999-12-31 23:59:59.997'
When such a form has never been an issue. Unless what you meant to say was this:
DECLARE @@SqlDateTimeMaxValue DATETIME
SET @@SqlDateTimeMaxValue = '9999-12-31 23:59:59.997'
Which is perfectly acceptable ("Command(s) completed successfully.")
|
|
|
|
|
Assigning a value to a variable when you declare it has been perfectly valid since SQL 2008.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Yes, thank-you Richard ...
John's a very busy man these days. What with the ... annoyances and all.
|
|
|
|
|
0) SQL Server has no server-wide variable for the max possible datetime.
1) SQL server does not support adding custom server-wide variables (such as @@ROWCOUNT ), so I can't add one myself.
2) I was trying to avoid doing exactly what you posted. I f*ckin know I can, I was just trying to avoid doing that in EVERY stored proc that needs it.
Are we all clear now?
|
|
|
|
|
Hi All,
Odd to see the newest message is getting for 8 hours old, I wonder if there is an issue?
Glenn
|
|
|
|
|
Nope, the newest thread may be that old but not the message.
|
|
|
|
|
Thank you for contacting The Lounge, your post is important to us.
Please hold and a member will deal with you when one becomes available.
In the meantime, please listen to the hold music[^].
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thank you for contacting The Lounge, your post is important to us.
I'm sorry that you have been waiting, we are having a busy period and will be with you as soon as possible. Please hold and a member will deal with you when one becomes available.
In the meantime, please listen to the hold music[^].
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thank you for contacting The Lounge, your post is important to us.
I'm sorry that you are still waiting, we are having a busy period and will be with you as soon as possible. Please hold and a member will deal with you when one becomes available. You currently are number 5833582 in the queue.
In the meantime, please listen to the hold music[^].
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thank you for contacting The Lounge, your post is important to us.
I'm sorry that you are still waiting, we are having a busy period and will be with you as soon as possible. Please hold and a member will deal with you when one becomes available. You currently are still number 5833582 in the queue.
In the meantime, please listen to the hold music[^].
Alternatively, you could use our electronic system if you know which department you need:
To continue in jargon, press 1. J os haluat jatkaa suomeksi, ole hyva ja paina 2.
Please listen closely to the following menus, as our options have changed. For technical support, press 1. For financial support, press 2. For support of the fleshy parts that jiggle during exercise, press 3. For emotional support, please hang up and call 888 HOT-LIVE.
Please note that we are currently experiencing temporary, localized service interruptions in Nome, Alaska *; Phoenix, Ariz.; Tijuana, Mexico; and all of North America east of the Rocky Mountains. If you live in one of these regions, please hang up and do not call back until we tell you. We appreciate your patience while our technicians ignore the problem.
If your appliance is less than 1 year old, press 1. If you are unmarried or are not sure, press 2.
In order to serve you better, it will be helpful for us to know which order you belong to. For Primates, press 1. For Cetacea and Proboscidea, press 2. For Jesuit or Dominican, press 3. For Knights Templar or Hospitaler, Knights of Pythias or Columbus, as well as Masons, Elks, and Kiwanis, or if you are unsure, press 4. If you are a Franciscan and have a rotary phone, please stay on the line.
Please key in the model and serial number of the product you are calling about. The model number is the series of 12 letters and digits that is visible when you push the unit away from the wall, work your head into the gap using a crowbar and No. 10 machine oil, and train a beam of ultraviolet light on the lower three centimeters of the right-hand rear surface of the appliance. If the model number is obscured by dust or cockroach detritus, wipe it with a soft, lint-free cloth soaked in a solution of ordinary rubbing alcohol, Kirschwasser, and formaldehyde. The serial number is the 37-digit number inscribed by means of laser nanotechnology on the underside of the unit and is not visible to the naked eye. When you have entered both numbers, press the pound key.
Note that at any point you may return to the previous menu by hanging up, calling again, and repeating the process until you reach the point just before the point you are at right now.
Please listen carefully to the following choices and select the one that best describes the problem you are calling about: If water is condensing on inner surfaces or leaking from under the door, press 1. If you are having trouble sending or receiving e-mail, press 2. If you are experiencing sharp, shooting pains in the left shoulder or a feeling of constriction in the chest, press 3. If you have lost your faith in a Supreme Being or any intelligible order in the universe and feel a desperate need for human contact, press 4. If you smell gas, press 5. To repeat this menu, press 6. To return to the previous menu or to a state of infantile bliss, press 7.
Please note that while you were listening to the previous menu, our options changed yet again. For Option 1, press 4. For Option 7, press 3. For Option 6, press 7. For Options 2 through 4, press 0 or hang up and call our Consumer Relations Department at (427) 555-9221. Long-distance charges may apply.
Most common problems can be resolved at home by following a simple sequence of diagnostic tests and procedures. We will now guide you through such a sequence. If you wish to skip this section, press 1, 3, and 9 simultaneously while restarting your telephone. Please note: If, while answering these questions, you see smoke or flames or if your chest is warm to the touch, hang up and call 911.
Stolen from Slate.com[^]
Sent from my Amstrad PC 1640
Never throw anything away, Griff
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
Thank you. I needed a good laugh this morning.
_______________________________________________________________
Ah don't lean on me man, cause you can't afford the ticket
|
|
|
|
|