September 3, 2014 at 12:05 pm
Hi,
I need to create to create view on a table. Suppose if I have Firstname, Lastname & DOB in the physical table.
I need to mask the data from the original table. How can we do that?
Create view view_sample As
select ( null as Firstname, Hide as Lastname)
instead of the First name 'John', I just need to display null or something
Any quick help please
September 3, 2014 at 1:09 pm
There are likely to be many ways to do this.
Here's a quick way to mask the column.
CREATE VIEW Masked AS
SELECT REPLICATE('*',LEN(FirstName)) FirstName,
REPLICATE('*',LEN(LastName)) LastName,
'----/--/--' AS DOB
FROM Table
September 3, 2014 at 2:02 pm
Thanks Micky
September 3, 2014 at 2:16 pm
Or you could just leave those columns out of the view entirely. If you are truly concerned about the data you might consider a constant for both names instead of divulging the length of the actual data.
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
September 8, 2014 at 7:46 am
Hi,
I created a view in dev box. I need to deploy that in the production.
How to create deployment scripts for the views with all the commands needed to deploy including grants.
Thanks
September 8, 2014 at 7:51 am
ramana3327 (9/8/2014)
Hi,I created a view in dev box. I need to deploy that in the production.
How to create deployment scripts for the views with all the commands needed to deploy including grants.
Thanks
Try this link. https://www.google.com/?gws_rd=ssl#q=sql+server+script+view+for+deployment
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply