DECLARE @Result nvarchar(255);
DECLARE @Random float;
SET @Random = RAND( (DATEPART(mm, GETDATE()) * 100000 )
+ (DATEPART(ss, GETDATE()) * 1000 )
+ DATEPART(ms, GETDATE() )) ;
SET @Random = (10000000000) * @Random;
Set @Result = convert(nvarchar(25), convert(bigint, @Random));
select 'A_ '+ @Result
SELECT CONVERT(varchar(255), NEWID()) RandomNumber;
IF NOT EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Table_Name' AND COLUMN_NAME = 'Column_Name')
ALTER TABLE 'Table_Name' ADD 'Column_Name ' nvarchar(255) NULL
DECLARE @Random float;
SET @Random = RAND( (DATEPART(mm, GETDATE()) * 100000 )
+ (DATEPART(ss, GETDATE()) * 1000 )
+ DATEPART(ms, GETDATE() )) ;
SET @Random = (10000000000) * @Random;
Set @Result = convert(nvarchar(25), convert(bigint, @Random));
select 'A_ '+ @Result
SELECT CONVERT(varchar(255), NEWID()) RandomNumber;
IF NOT EXISTS( SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = 'Table_Name' AND COLUMN_NAME = 'Column_Name')
ALTER TABLE 'Table_Name' ADD 'Column_Name ' nvarchar(255) NULL
No comments:
Post a Comment