Here's an example of how I do it in SQL tables, Ubaidullah. Table has a default value for the GUID that automatically uses a function to generate one when a new row is inserted. That function relies on a view to make SQL random be non-deterministic. (Google is my friend!)
-- jf 12/10/2018 - used by jfGuid function
create view iFunction as
select MyNewID = newid(),
MyDate = getdate(),
MyString = cast(newid() as varchar(36)),
MyChar = char(floor(rand() *(122-97+1)+97)),
MyNum = cast((floor(rand() *(9) + 1)) as char(1)),
MySelector = floor(rand()*(2-1+1) + 1);
-- jf 12/10/2018 - make non-standard guid
-- relies on iFunction view for non-deterministic random stuff
-- EX version has parameters for length and case. This one uses defaults
create function jfGuid ()
returns varchar(100)
as
begin;
declare @a int = 1,@len int = 16;
declare @rv varchar(16)='',@selector int,@thisChar char(1);
while @a <= @len
begin;
set @a +=1;
select @selector = MySelector from ifunction
--print @selector;
if @selector = 1
begin;
select @thisChar = MyChar from iFunction
end;
else
begin;
select @thisChar = MyNum from iFunction
end;
set @rv += @thisChar;
--print 'rv = '+ @rv;
end;
select @rv = upper(@rv);
return @rv;
end;
CREATE TABLE [dbo].[appLoginAudit](
[pk] [int] IDENTITY(1,1) NOT NULL,
[GUID] [char](16) NOT NULL,
[windowsName] [varchar](100) NULL,
[workstationName] [varchar](100) NULL,
[appName] [varchar](20) NULL,
[startupTime] [datetime] NULL,
[activeTimeBias] [int] NULL,
[ts] [float] NULL,
[sts] [float] NULL,
[dts] [float] NULL,
CONSTRAINT [appLoginAuditGuid] PRIMARY KEY CLUSTERED
(
[GUID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[appLoginAudit] ADD DEFAULT ([dbo].[jfGuid]()) FOR [GUID]
GO
ALTER TABLE [dbo].[appLoginAudit] ADD DEFAULT ([dbo].[jfUtcOffset]()) FOR [activeTimeBias]
GO
ALTER TABLE [dbo].[appLoginAudit] ADD DEFAULT ((0)) FOR [ts]
GO
ALTER TABLE [dbo].[appLoginAudit] ADD DEFAULT ((0)) FOR [sts]
GO
ALTER TABLE [dbo].[appLoginAudit] ADD DEFAULT ((0)) FOR [dts]
GO
[edited to add remaining table defaults]