Some use Stored Procedures, some date use inline queries.
(It can be used as the server default value for the column time also).
It's so compact I think I might actually remember.
Method two, on the other hand, consisently performed at the same speed, give or take a [email protected], I think you have way more DB experience than I do, so I cannot argue one way or the other.They may know the syntax, but they have no real idea of what is going on 'under the hood' and that's a truely dangerous person to employ.Rene thanks everything, date it helps thank you @Ben, Your solution looks more elegant than what I've been using in the past, but wouldn't the following be just as efficient or is floor better than cast to varchar?If you wish, take a look at a script I linked to some time ago server and add your own cast(column as date) test to the mix.I think with some of the earlier date posts, I had multiple people posting from the *same* IP Address.It won't be pretty I am sure, but it might work Not sure what your problem.It doesn't bust the optimiser's ability to utilize indexes.So in a table in which I actually want to store insert the time portion, I would include the calculated column using the UDF and also create an index on the dateonly column if it were going to be a column that is frequently used.I think I have to use the.SubString(0,.IndexOf function to get the date only part. I need a lill help from you crack all smartys!
Having games said this, I'm always looking for code pieces I can wrap my insert brain around and discovered a method that works for my needs.
I am developing.NET version application.I added with schemabinding and it hunger made all my functions deterministic.On tables where the date-only column is missing I will create it and run a Createodbcdate on the date, then index this new column.However, they both give identical results.User Reviews, all Versions.0 out of 3 votes 5 star 3 4 star 0 3 star 0 2 star 0 1 star 0, episode report Offensive alicia Content, if you believe this comment is offensive or violates the.If you convert(datetime, colname) it will return a datetime as long as the data you supply it is proper.All your examples are determistic but the reason why is not stated.
Actually as I write this you are making me think that I might need to test the function that used the datediff because the quick test I did may have insert date and time in sql server 2005 not been deterministic because I might have forgotten some of those requirements.
Comments: (optional submit cancel, thank You for Helping us Maintain cnet's Great Community!
Thanks Landon select reportdate, worktype, maintby, cast( floor( cast( getDate AS float ) ) AS datetime )as timeret, convert(nvarchar(20 getdate 102) AS JustTheDate, convert(nvarchar(20 reportdate, 102) AS newreportdate from workorder where worktype'pm' and maintby 'em' and newreportdateJustTheDate Landon, It's funny, I only recently learned about.