Viewing 15 posts - 1,951 through 1,965 (of 2,037 total)
Hello Roger
You can do it like:
DECLARE @d DATETIME
SET @d = GETDATE()
SELECT @d, CASE WHEN DATEPART(MONTH, @d) < 10 THEN '0' ELSE '' END + CONVERT(VARCHAR(2), DATEPART(MONTH, @d))
But as currently discussed...
March 11, 2009 at 5:35 am
Hi
Very good objection! I also don't know very much business cases which require this split.
Also a nice way. Thanks, I did not yet use ;).
Greets
Flo
March 11, 2009 at 3:24 am
Hi %
Thank you all for your suggestions! It seems to never mind wich syntax is used.
So as Bruce said; the reason for the used syntax is "because" 🙂 .
Bob Hovious...
March 11, 2009 at 3:16 am
Maybe wrong thread 😉
March 10, 2009 at 6:17 pm
Hi Bob!
Bob Hovious (3/10/2009)
I'm afraid I'm unable to duplicate your results. I'm comparing an insert into/SELECT ... union all against a insert into VALUES for 1000...
March 10, 2009 at 6:15 pm
Hello Bruce
Thank you for your answer! In my opinion it "because" a absolutely valid reason :).
I just found a third possibility in MSDN forums http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/8d2888ab-9ad6-47f2-a01c-0a487b1dc995/ which I never saw. Example:
DECLARE...
March 10, 2009 at 6:04 pm
Hi
You can avoid the VARCHAR conversion with a little trick based on the structure how SQL Server stores DATETIME values. Convert the DATETIME to FLOAT and use FLOOR to cut...
March 10, 2009 at 4:27 pm
Hi
You can use an INSTEAD OF trigger.
[font="Courier New"]
IF (OBJECT_ID('tab1') IS NOT NULL)
DROP TABLE tab1
CREATE TABLE tab1 (id INT, val INT)
IF (OBJECT_ID('tab1_audit') IS NOT NULL)
DROP TABLE tab1_audit
CREATE TABLE tab1_audit...
March 10, 2009 at 4:17 pm
Hi
It just doesn't matter if you use the MAX option or the 5000 and 2000 chars option. As usual the best way is to keep the row data less than...
March 10, 2009 at 4:00 pm
Tip: Use the ISNUMERIC function to find the non-numeric values:
DECLARE @t TABLE (txt VARCHAR(100))
INSERT INTO @t VALUES ('1.2')
INSERT INTO @t VALUES ('2a')
SELECT * FROM @t WHERE ISNUMERIC(txt) != 1
Greets
Flo
March 10, 2009 at 3:52 pm
Hi
REFERENCES grants are used for foreign keys. See http://msdn.microsoft.com/en-us/library/ms191291.aspx .
Greets
Flo
March 10, 2009 at 3:41 pm
Hello
The sysobjects is only available for backward compatibility in SQL Server 2005/2008.
You should use the sys.objects (on master database) or the sys.all_objects views.
Greets
Flo
March 10, 2009 at 3:33 pm
Hi
If you don't need the conversion for direct inserts or updates into other tables maybe think about formattin in your client application ;).
Greets
Flo
March 10, 2009 at 3:28 pm
Hi
Sure the code Lowell posted works fine for your specified problem. But the other guys will inform you that this kind of database-/table-desing may bring you into much more problems...
March 10, 2009 at 3:25 pm
Hello
I don't really know what's your specific problem now.
Maybe I'm wrong, but in my opinion this is a forum to find help for a specific problem like
* How to end...
March 10, 2009 at 3:17 pm
Viewing 15 posts - 1,951 through 1,965 (of 2,037 total)