July 17, 2015 at 6:49 am
Hi all,
I have the following attributes in this Table A.
1) Location_ID (int)
2) Serial_Number (nvarchar(Max))
3) KeyID (nvarchar(max)
4) Reference_Address (nvarchar(max)
5) SourceTime (datetime)
6) SourceValue (nvarchar)
I am trying to create 1000000 dummy records in this this table A
How do i go about do it? I would like my data to be something like this
LOCATION_ID
1
Serial Number
SN-01
KeyID
E1210
Reference_Address
83
SourceTime
2015-05-21 00:00:00 000
SourceValue
6200
Thank you, Hope to hear ur reply soon!
July 17, 2015 at 7:08 am
can we assume that the dummy records are all to be different eg different dates/serial numbers etc but in the format you describe?
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day
July 17, 2015 at 7:23 am
darren-hong (7/17/2015)
Hi all,I have the following attributes in this Table A.
1) Location_ID (int)
2) Serial_Number (nvarchar(Max))
3) KeyID (nvarchar(max)
4) Reference_Address (nvarchar(max)
5) SourceTime (datetime)
6) SourceValue (nvarchar)
I am trying to create 1000000 dummy records in this this table A
How do i go about do it? I would like my data to be something like this
LOCATION_ID
1
Serial Number
SN-01
KeyID
E1210
Reference_Address
83
SourceTime
2015-05-21 00:00:00 000
SourceValue
6200
Thank you, Hope to hear ur reply soon!
Quick thoughts, the data types seem somewhat strange, doubt you'll need nvarchar(max) for serial number, key id and reference address. Further on this, a single character nvarchar for source value does not look right either.
😎
July 17, 2015 at 9:58 am
All data are different
July 17, 2015 at 10:05 am
as an idea
SELECT TOP 100
LocID = 1 + CAST(ABS(CHECKSUM(NEWID()) % 9) AS int),
SerialNo = 'SN-' + CAST(ABS(CHECKSUM(NEWID()) % 90000) AS varchar(5)),
KeyID = CHAR(ABS(CHECKSUM(NEWID())) % 26 + 65) + CAST(ABS(CHECKSUM(NEWID()) % 9000) AS varchar(4)),
Ref_Add = CAST(ABS(CHECKSUM(NEWID()) % 90) AS varchar(2)),
SourceTime = DATEADD(dd , ABS(CHECKSUM(NEWID())) % DATEDIFF(dd , '2014' , '2015') , '2014'),
SourceValue = 1 + CAST(ABS(CHECKSUM(NEWID()) % 9000) AS int)
--INTO ATABLE
FROM sys.all_columns AS ac1
CROSS JOIN sys.all_columns AS ac2
CROSS JOIN sys.all_columns AS ac3;
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day
July 17, 2015 at 10:12 am
Hi Thanks for your help.
Could u include Insert statement as well ?
July 17, 2015 at 10:20 am
darren-hong (7/17/2015)
Hi Thanks for your help.Could u include Insert statement as well ?
uncomment this line
--INTO ATABLE
________________________________________________________________
you can lead a user to data....but you cannot make them think
and remember....every day is a school day
Viewing 8 posts - 1 through 7 (of 7 total)
You must be logged in to reply to this topic. Login to reply