sql语句精剪数据长度函数substring(string,int,int)

1.查询某字段数据长度>8的数据

/****** SSMS 的 SelectTopNRows 命令的脚本  ******/
SELECT
      *
  FROM [Database].[dbo].[VideosTable]
  where len(ReleaseTime)>8;

结果:

2.精剪数据长度(去掉前4位)

  Update [Database].[dbo].[VideosTable] 
  set ReleaseTime=substring(ReleaseTime,5,8)
    where len(ReleaseTime)>8;

结果:

 

365个夜晚,我希望做到两天更一篇博客。加油,小白!
原文地址:https://www.cnblogs.com/qq2806933146xiaobai/p/14245200.html