Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How SqlServer 2008 creates test data

2025-02-28 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

Editor to share with you how to create SqlServer 2008 test data, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!

Contains main points: database loops, insert select sentence patterns, random numbers (rand () function), absolute values (abs () function)

DECLARE @ starttime varchar (50) DECLARE @ endtime varchar (50) DECLARE @ randomvalue float SET @ starttime='2017-09-15 0000 DECLARE 15V 00.000' SET @ endtime='2017-10-20 0000RV 00.000mm set @ randomvalue=floor (rand () * 10)-select CONVERT (varchar (50), DATEADD (mi,15,@starttime), 121)-- select [TagID], [Value]-@ randomvalue, [StartValue]-@ randomvalue,CONVERT (varchar (50), DATEADD (mi,15, [StartTime]) [EndValue]-@ randomvalue,CONVERT (varchar (50), DATEADD (mi,15, [EndTime]), 121)-- from [dbo]. [DimTagMinuteData] where TagID in -- and StartTime=@starttime and EndTime=CONVERT (varchar (50), DATEADD (mi,15,@starttime), 121) WHILE @ starttime

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report