Jump to content

Ms Sql Server Technology Discussions


9Pardhu

Recommended Posts

[quote name='deals2buy' timestamp='1353430948' post='1302829723']

if you are comparing dates with varchar then convert the datetype to varchar during comparison so that u need not change the datatypes of any objects (since they were modelled in such a way)

@DARLING: good post rey
[/quote]
[quote name='DARLING...' timestamp='1353431285' post='1302829761']

No Problem rey be happy
[/quote]

Meeting lu peti sava 10gesthunaru baa..... Rape chestunaru nannu. Motham business grinchi talking so naku mind ki em strike avadam ledu. Final ga edo conclude chesaru oka Doc pampisthanu niku help ithadi ani... aa okka mukha thapa inka emi ardham kaledu.

Pchiki ekesthondi bhayya... But still try chestanu edo okati manaku thapadu kada

Link to comment
Share on other sites

[quote name='karna11' timestamp='1353443134' post='1302830985']
SELECT * FROM SYS.objects WHERE type_desc = 'CHECK_CONSTRAINT' ILA KODA VASTHUNDHII BAA, IPPUDEE TELUSUKUNNA, CORRECT ME IF IM WRONG
[/quote]
needi which version? 2000 lo idi work avvatam ledu...I get this error msg
Msg 208, Level 16, State 1, Line 1
Invalid object name 'sys.objects'.

[quote name='Desamudhuru' timestamp='1353447183' post='1302831576']
Meeting lu peti sava 10gesthunaru baa..... Rape chestunaru nannu. Motham business grinchi talking so naku mind ki em strike avadam ledu. Final ga edo conclude chesaru oka Doc pampisthanu niku help ithadi ani... aa okka mukha thapa inka emi ardham kaledu.

Pchiki ekesthondi bhayya... But still try chestanu edo okati manaku thapadu kada
[/quote]

meeting lo em try chestunnav vayya? @3$%

Link to comment
Share on other sites

[b] Display Datetime in Specific Format[/b]


A very common requirement of developers is to format datetime to their specific need. Every geographic location has different need of the date formats. Some countries follow the standard of [i][b]mm/dd/yy[/b][/i] and some countries as [i][b]dd/mm/yy[/b][/i]. The need of developer changes as geographic location changes. In SQL Server there are various functions to aid this requirement. There is function CAST, which developers have been using for a long time as well function CONVERT which is a more enhanced version of CAST. In the latest version of SQL Server 2012 a new function FORMAT is introduced as well.

In this SQL in Sixty Seconds video we cover two different methods to display the datetime in specific format. 1) CONVERT function and 2) FORMAT function.

http://www.youtube.com/watch?v=61pHO5pZ1o4&feature=player_embedded

[color=green]-- SQL Server 2000/2005/2008/2012 onwards
-- Datetime[/color]
[color=blue]SELECT [/color][color=magenta]CONVERT[/color][color=gray]([/color][color=blue]VARCHAR[/color][color=gray]([/color][color=black]30[/color][color=gray]),[/color][color=magenta]GETDATE[/color][color=gray]()) [/color][color=blue]AS [/color][color=black]DateConvert[/color][color=gray];[/color]
[color=blue]SELECT [/color][color=magenta]CONVERT[/color][color=gray]([/color][color=blue]VARCHAR[/color][color=gray]([/color][color=black]30[/color][color=gray]),[/color][color=magenta]GETDATE[/color][color=gray](),[/color][color=black]10[/color][color=gray]) [/color][color=blue]AS [/color][color=black]DateConvert[/color][color=gray];[/color]
[color=blue]SELECT [/color][color=magenta]CONVERT[/color][color=gray]([/color][color=blue]VARCHAR[/color][color=gray]([/color][color=black]30[/color][color=gray]),[/color][color=magenta]GETDATE[/color][color=gray](),[/color][color=black]110[/color][color=gray]) [/color][color=blue]AS [/color][color=black]DateConvert[/color][color=gray];[/color]
[color=blue]SELECT [/color][color=magenta]CONVERT[/color][color=gray]([/color][color=blue]VARCHAR[/color][color=gray]([/color][color=black]30[/color][color=gray]),[/color][color=magenta]GETDATE[/color][color=gray](),[/color][color=black]5[/color][color=gray]) [/color][color=blue]AS [/color][color=black]DateConvert[/color][color=gray];[/color]
[color=blue]SELECT [/color][color=magenta]CONVERT[/color][color=gray]([/color][color=blue]VARCHAR[/color][color=gray]([/color][color=black]30[/color][color=gray]),[/color][color=magenta]GETDATE[/color][color=gray](),[/color][color=black]105[/color][color=gray]) [/color][color=blue]AS [/color][color=black]DateConvert[/color][color=gray];[/color]
[color=blue]SELECT [/color][color=magenta]CONVERT[/color][color=gray]([/color][color=blue]VARCHAR[/color][color=gray]([/color][color=black]30[/color][color=gray]),[/color][color=magenta]GETDATE[/color][color=gray](),[/color][color=black]113[/color][color=gray]) [/color][color=blue]AS [/color][color=black]DateConvert[/color][color=gray];[/color]
[color=blue]SELECT [/color][color=magenta]CONVERT[/color][color=gray]([/color][color=blue]VARCHAR[/color][color=gray]([/color][color=black]30[/color][color=gray]),[/color][color=magenta]GETDATE[/color][color=gray](),[/color][color=black]114[/color][color=gray]) [/color][color=blue]AS [/color][color=black]DateConvert[/color][color=gray];[/color]
[color=black]GO[/color]
[color=green]-- SQL Server 2012 onwards
-- Various format of Datetime[/color]
[color=blue]SELECT [/color][color=magenta]CONVERT[/color][color=gray]([/color][color=blue]VARCHAR[/color][color=gray]([/color][color=black]30[/color][color=gray]),[/color][color=magenta]GETDATE[/color][color=gray](),[/color][color=black]113[/color][color=gray]) [/color][color=blue]AS [/color][color=black]DateConvert[/color][color=gray];[/color]
[color=blue]SELECT [/color][color=black]FORMAT [/color][color=gray]( [/color][color=magenta]GETDATE[/color][color=gray](), [/color][color=red]'dd mon yyyy HH:m:ss:mmm'[/color][color=gray], [/color][color=red]'en-US' [/color][color=gray]) [/color][color=blue]AS [/color][color=black]DateConvert[/color][color=gray];[/color]
[color=blue]SELECT [/color][color=magenta]CONVERT[/color][color=gray]([/color][color=blue]VARCHAR[/color][color=gray]([/color][color=black]30[/color][color=gray]),[/color][color=magenta]GETDATE[/color][color=gray](),[/color][color=black]114[/color][color=gray]) [/color][color=blue]AS [/color][color=black]DateConvert[/color][color=gray];[/color]
[color=blue]SELECT [/color][color=black]FORMAT [/color][color=gray]( [/color][color=magenta]GETDATE[/color][color=gray](), [/color][color=red]'HH:m:ss:mmm'[/color][color=gray], [/color][color=red]'en-US' [/color][color=gray]) [/color][color=blue]AS [/color][color=black]DateConvert[/color][color=gray];[/color]
[color=black]GO[/color]
[color=green]-- Specific usage of Format function[/color]
[color=blue]SELECT [/color][color=black]FORMAT[/color][color=gray]([/color][color=magenta]GETDATE[/color][color=gray](), [/color][color=red]N'"Current Time is "dddd MMMM dd, yyyy'[/color][color=gray], [/color][color=red]'en-US'[/color][color=gray]) [/color][color=blue]AS [/color][color=black]CurrentTimeString[/color][color=gray];[/color]


This video discusses CONVERT and FORMAT in simple manner but the subject is much deeper and there are lots of information to cover along with it. I strongly suggest that you go over related blog posts in next section as there are wealth of knowledge discussed there.

Link to comment
Share on other sites

[quote name='Desamudhuru' timestamp='1353519673' post='1302836561']
Flat file nundi DB ki push chestuna datani. Oka column ABOUTME ani vundi. The "output column" ABOUTME truncation occured ani estondi daniki em cheyali baa ??
[/quote]
I guess nee DB column size source file kante takkuva undemo..

Link to comment
Share on other sites

[quote name='deals2buy' timestamp='1353519787' post='1302836576']
I guess nee DB column size source file kante takkuva undemo..
[/quote]
ade doubt vochi DB column size ni MAX ki set chesanu bhayya

Link to comment
Share on other sites

[quote name='Desamudhuru' timestamp='1353519862' post='1302836583']
ade doubt vochi DB column size ni MAX ki set chesanu bhayya
[/quote]

also, did u check the datatype ?

Link to comment
Share on other sites

[quote name='Desamudhuru' timestamp='1353519957' post='1302836593']
Varchar petanu bhayya
[/quote]

aina kuda error vastonda? about me column lo unna data okati sample eyyagalava?

Link to comment
Share on other sites

i'm here to help you get started with chatter. I'll introduce you to fearutes, create sample posts, and suggest tips and best practices.



oka 15 mins lo vostanu baa china meeting vundi

Link to comment
Share on other sites

[quote name='Desamudhuru' timestamp='1353520580' post='1302836651']
[b][color=#ff0000]i'm [/color][/b]here to help you get started with chatter. [b][color=#ff0000]I'll[/color][/b] introduce you to fearutes, create sample posts, and suggest tips and best practices.



oka 15 mins lo vostanu baa china meeting vundi
[/quote]

delimiters emani set chesaav package lo?

Link to comment
Share on other sites

[quote name='Desamudhuru' timestamp='1353520827' post='1302836666']
[color=#ff0000]"[/color] echanu
[/quote]


package lo ee column lo emani mention chesavo chudu

[img]http://www.bradleyschacht.com/wp-content/uploads/2012/03/AdvancedEditorDefault.png[/img]

Link to comment
Share on other sites

[quote name='deals2buy' timestamp='1353521695' post='1302836737']


package lo ee column lo emani mention chesavo chudu

[img]http://www.bradleyschacht.com/wp-content/uploads/2012/03/AdvancedEditorDefault.png[/img]
[/quote]



Yeah akada length kuda change chesa baa iyina error esthondi

Link to comment
Share on other sites

×
×
  • Create New...