I'm new to SQL.
Here's my question,
I need to get the hour and minutes to show like hm, example (832 or 1125 or ...),
I used this :

SELECT DATEPART(minute,My Field)  

it gives me the info, but I can't seem able to combine both.

Thanks for any help.
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Aneesh RetnakaranDatabase AdministratorCommented:
SELECT cast(REPLACE(CONVERT(varchar(5),getdate(), 108),':','') AS INT)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Aneesh RetnakaranDatabase AdministratorCommented:
SELECT  CAST( DATEPART(hour,My Field) as varchar ) +
               CAST( DATEPART(minute,My Field)  as varchar )
wassimqaAuthor Commented:
I get a syntax error when using
SELECT cast(REPLACE(CONVERT(varchar(5),MY Field 108),':','') AS INT)

My field looks like: May 29 2008  8:22AM
10 Tips to Protect Your Business from Ransomware

Did you know that ransomware is the most widespread, destructive malware in the world today? It accounts for 39% of all security breaches, with ransomware gangsters projected to make $11.5B in profits from online extortion by 2019.

Aneesh RetnakaranDatabase AdministratorCommented:
did you miss the comma

SELECT cast(REPLACE(CONVERT(varchar(5),[MY Field] ,108),':','') AS INT)
wassimqaAuthor Commented:
yes, I missed the comma,
Beginners mistake,
Thanks again.
wassimqaAuthor Commented:
excellent work
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2005

From novice to tech pro — start learning today.