Get date, time
Retrieve the current date and time
select getdate()
(or in MySQL: select now())
Retrieve only date, only time
select * from flights
where convert(date, ariveddate) = '2021-02-22'
select * from flights
where convert(time,arriveddate) >'13:00'
String
update articles
set imageurl = convert(varchar(10), articleid)+ '.jpg'
Wildcard character
select ('^'+Pattern), Pattern,* from Pictures
where Pattern like '%[.]%' and CHARINDEX('^', Pattern)<>1
Trim
select count(*) from flights
where code like '% '
update flights
set code = trim(code)
where code like '% '
update Flights
set AircraftCode = trim(AircraftCode)
where CHARINDEX(' ',AircraftCode) > len(trim(AircraftCode))
0 Comments
Đăng nhận xét