0

I have a question around SQL Server. How to take data backup without prefix N' in each value before.

Database ... > Tasks ... > Generate Scripts ... > Next ... > select specific database objects...>choose table..>next..> open new querywindow..> advanced ..>type of datatoscript..>schema only...next

The insert script I get looks like this:

INSERT [dbo].[emp] ([id], [name], [sal], [loc]) VALUES (1, N'abc', 10.0000, N'unknowN')
GO
INSERT [dbo].[emp] ([id], [name], [sal], [loc]) VALUES (2, N'unknown', 20.0000, N'che')
GO
INSERT [dbo].[emp] ([id], [name], [sal], [loc]) VALUES (3, N'nkiln', 89.0000, N'nl')
GO
INSERT [dbo].[emp] ([id], [name], [sal], [loc]) VALUES (4, N'ravin', 0.0000, N'nrN')
GO

I want an insert script without the prefix N' like this:

INSERT [dbo].[emp] ([id], [name], [sal], [loc]) VALUES (1, 'abc', 10.0000, 'unknowN')
GO
INSERT [dbo].[emp] ([id], [name], [sal], [loc]) VALUES (2, 'unknown', 20.0000, 'che')
GO
INSERT [dbo].[emp] ([id], [name], [sal], [loc]) VALUES (3, 'nkiln', 89.0000, 'nl')
GO
INSERT [dbo].[emp] ([id], [name], [sal], [loc]) VALUES (4, N'ravin', 0.0000, N'nrN')
GO

Please tell me any setting need and how to take insert scripts backup without prefix N' .

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • I don't think there's any setting or way to do this - SQL Server will always use the `N'...'` notation - even if it's a `varchar` (and thus non-Unicode) column, unfortunately – marc_s Dec 10 '22 at 06:24
  • Hmmm... Give the following a look https://stackoverflow.com/a/55471900, at the end of the day, you kind of require it if you use unicode. It's never a good idea to cater for a specific use case, so I would advise just to throw the N' in. It's not too hard to update queries to use it. – Andy Dec 10 '22 at 06:29

0 Answers0