Solveing DateTime problem (SQL Server)
Are you created a table have a dateTime field before ? Are this field made a problem with your application because both of them have a different format ? if you don't want to change the operating system dateTime format to unify both …..
Read , this article that try to solve this headaches .
- getdate()
- convert ( , )
select convert(varchar, getdate(), 9)
that returns :
Rang (1 to 7 + 10 + 101 to 107 + 110 + 111 ) Date format
Rang ( form 8 + 14 ) Time format
Rang ( 9 or 109 ) DateTime format
Explore this simple Demo :
create table fci_blog_table1
(
z datetime null
)
/*Demo1 ,How to insert */
insert into fci_blog_table1 values ( convert(varchar, getdate(), 1))
create proc fci_blog_pro1 /*to make a stored proceure*/
@x int output
as
select @x = 1
WHILE (@x < style="color: rgb(51, 51, 255);">BEGIN
select convert(varchar, getdate(), @x)
select @x = @x + 1
END
PRINT 'Have a nice time'
DECLARE @TheCount int
EXEC fci_blog_pro1
@x = @TheCount OUTPUT
Select TheCount = @TheCount
No comments:
Post a Comment