Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 533307
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:29:43+00:00 2026-05-13T09:29:43+00:00

I’m work on project in c# ,and I want to generate data from my

  • 0

I’m work on project in c# ,and I want to generate data from my db and pass it to the server just when I need to do that, so I can then run this file on server , Can I generate this file from c#?
and how can I generate file like this from sql:

SET NOCOUNT ON
GO

USE master
 GO
IF EXISTS ( SELECT  *
            FROM    sysdatabases
            WHERE   name = 'Northwind' ) 
  DROP DATABASE Northwind
 go

DECLARE @device_directory nvarchar(520)
SELECT  @device_directory = SUBSTRING(filename, 1,
                                      CHARINDEX(N'master.mdf', LOWER(filename))
                                      - 1)
FROM    master.dbo.sysaltfiles
WHERE   dbid = 1
        AND fileid = 1

EXECUTE (N'CREATE DATABASE Northwind ON PRIMARY (NAME = N''Northwind'', FILENAME = N''' + @device_directory + N'northwnd.mdf'') LOG ON (NAME = N''Northwind_log'', FILENAME = N''' + @device_directory + N'northwnd.ldf'')')
 go

EXEC sp_dboption 'Northwind', 'trunc. log on chkpt.', 'true'
EXEC sp_dboption 'Northwind', 'select into/bulkcopy', 'true'
 GO

SET quoted_identifier ON
 GO

/* Set DATEFORMAT so that the date strings are interpreted correctly regardless of the default DATEFORMAT on the server. */
SET DATEFORMAT mdy
 GO
USE "Northwind"

GO
IF EXISTS ( SELECT  *
            FROM    sysobjects
            WHERE   id = OBJECT_ID('dbo.Customers')
                    AND sysstat & 0xf = 3 ) 
  DROP TABLE "dbo"."Customers"

CREATE TABLE "Customers"
  ( 
   "CustomerID" nchar(5) NOT NULL
  ,"CompanyName" nvarchar(40) NOT NULL
  ,"ContactName" nvarchar(30) NULL
  ,"ContactTitle" nvarchar(30) NULL
  ,"Address" nvarchar(60) NULL
  ,"City" nvarchar(15) NULL
  ,"Region" nvarchar(15) NULL
  ,"PostalCode" nvarchar(10) NULL
  ,"Country" nvarchar(15) NULL
  ,"Phone" nvarchar(24) NULL
  ,"Fax" nvarchar(24) NULL
  ,CONSTRAINT "PK_Customers" PRIMARY KEY CLUSTERED ( "CustomerID" )
  )
 GO
CREATE INDEX "City" ON "dbo"."Customers"("City")
 GO
CREATE INDEX "CompanyName" ON "dbo"."Customers"("CompanyName")
 GO
CREATE INDEX "PostalCode" ON "dbo"."Customers"("PostalCode")
 GO
CREATE INDEX "Region" ON "dbo"."Customers"("Region")
 GO

ALTER TABLE "Customers" NOCHECK CONSTRAINT ALL
 go
INSERT  "Customers"
VALUES  ( 'ALFKI', 'Alfreds Futterkiste', 'Maria Anders',
          'Sales Representative', 'Obere Str. 57', 'Berlin', NULL, '12209',
          'Germany', '030-0074321', '030-0076545' )
INSERT  "Customers"
VALUES  ( 'ANATR', 'Ana Trujillo Emparedados y helados', 'Ana Trujillo',
          'Owner', 'Avda. de la Constitución 2222', 'México D.F.', NULL,
          '05021', 'Mexico', '(5) 555-4729', '(5) 555-3745' )
INSERT  "Customers"
VALUES  ( 'ANTON', 'Antonio Moreno Taquería', 'Antonio Moreno', 'Owner',
          'Mataderos 2312', 'México D.F.', NULL, '05023', 'Mexico',
          '(5) 555-3932', NULL )
INSERT  "Customers"
VALUES  ( 'AROUT', 'Around the Horn', 'Thomas Hardy', 'Sales Representative',
          '120 Hanover Sq.', 'London', NULL, 'WA1 1DP', 'UK', '(171) 555-7788',
          '(171) 555-6750' )
INSERT  "Customers"
VALUES  ( 'BERGS', 'Berglunds snabbköp', 'Christina Berglund',
          'Order Administrator', 'Berguvsvägen 8', 'Luleå', NULL, 'S-958 22',
          'Sweden', '0921-12 34 65', '0921-12 34 67' )
INSERT  "Customers"
VALUES  ( 'BLAUS', 'Blauer See Delikatessen', 'Hanna Moos',
          'Sales Representative', 'Forsterstr. 57', 'Mannheim', NULL, '68306',
          'Germany', '0621-08460', '0621-08924' )
INSERT  "Customers"
VALUES  ( 'BLONP', 'Blondesddsl père et fils', 'Frédérique Citeaux',
          'Marketing Manager', '24, place Kléber', 'Strasbourg', NULL, '67000',
          'France', '88.60.15.31', '88.60.15.32' )
INSERT  "Customers"
VALUES  ( 'BOLID', 'Bólido Comidas preparadas', 'Martín Sommer', 'Owner',
          'C/ Araquil, 67', 'Madrid', NULL, '28023', 'Spain', '(91) 555 22 82',
          '(91) 555 91 99' )
INSERT  "Customers"
VALUES  ( 'BONAP', 'Bon app''', 'Laurence Lebihan', 'Owner',
          '12, rue des Bouchers', 'Marseille', NULL, '13008', 'France',
          '91.24.45.40', '91.24.45.41' )
INSERT  "Customers"
VALUES  ( 'BOTTM', 'Bottom-Dollar Markets', 'Elizabeth Lincoln',
          'Accounting Manager', '23 Tsawassen Blvd.', 'Tsawassen', 'BC',
          'T2F 8M4', 'Canada', '(604) 555-4729', '(604) 555-3745' )
 go
ALTER TABLE "Customers" CHECK CONSTRAINT ALL

for any suggest ,thanks in advance 🙂
Dani

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T09:29:44+00:00Added an answer on May 13, 2026 at 9:29 am

    The SSMS Tools Pack is a plug-in for SQL Server Management Studio that has a lot of useful functionality, including generation of insert scripts from table data.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.