Friday, March 30, 2012
Importing XML File via URL using MSSQL 2005
the file via a URL and import this into my SQL database.
I'm fairly new to SQL 2005 but this seems to be a simple task. I've looked
at using the Import Export wizard but I don't see a simpl way to do this.
I've tried selecting "Flat File" as my data source but this does not seem to
be able to read XML. I've tried the SQLSML data sources but I don't think
this will work if the web server is not IIS.
Does anyone have any ideas?"Bryan" <Bryan@.discussions.microsoft.com> wrote in message
news:37B66D17-FE91-4CFD-B502-DB80BD2B8360@.microsoft.com...
>I have an XML file that is hosted on a mainframe web server. I need to
>read
> the file via a URL and import this into my SQL database.
> I'm fairly new to SQL 2005 but this seems to be a simple task. I've
> looked
> at using the Import Export wizard but I don't see a simpl way to do this.
> I've tried selecting "Flat File" as my data source but this does not seem
> to
> be able to read XML. I've tried the SQLSML data sources but I don't think
> this will work if the web server is not IIS.
> Does anyone have any ideas?
Write a SQLCLR function in C# or VB to retrieve the data from the web
server.
Wednesday, March 28, 2012
Importing text file
fit in here better.
Using VS.Net 2003 I built an ASP.Net Web application using
VB.Net. I connect to an SQL db(SQL Server 2000) and am setup to
write/read/edit data no problem. I'm having a problems with the following
scenario. Any help, advice, or if you could point me in the right direction
is highly appreciated.
1. The user clicks a button which opens the Find file dialogue box.
2. They navigate to the text(or possible dbf file) and click ok.
3. The a temp table is created and the text(dbf) file is imported
creating the temp table
4. A procedure is run the takes my active data(an existing table) and
archives(appends) that data to an archive table. Before this though the
data in the archive table needs to be deleted.
5. The data from my live table is deleted.
6. Data from my imported temp table is appended to the live table.
7. Temp table is deleted.
I read some stuff about DTS packages but I'm not real familiar with SQL
Server and don't know how exactly to call the DTS package from my
application and/or if DTS is actually the way to go. The text file is
delimited and contains field names that will map directly to my existing
tables. Not looking for a hand out so if you could get me pointed in the
right direction I'm not against doing more research, but at this time I'm
not exactly sure where to start. Thanks again for your time.Hi
The following web site has lots of information on DTS. There is also alot of
information in Books online (which can be downloaded from
http://www.microsoft.com/downloads/...&displaylang=en
if you don't have it!). You may also want to look up BCP or Bulk Insert as a
alternative method.
John
"Reggie" wrote:
> HI and TIA. I posted this to a vs.net NG but after looking thought it mig
ht
> fit in here better.
> Using VS.Net 2003 I built an ASP.Net Web application using
> VB.Net. I connect to an SQL db(SQL Server 2000) and am setup to
> write/read/edit data no problem. I'm having a problems with the following
> scenario. Any help, advice, or if you could point me in the right directi
on
> is highly appreciated.
> 1. The user clicks a button which opens the Find file dialogue box.
> 2. They navigate to the text(or possible dbf file) and click ok.
> 3. The a temp table is created and the text(dbf) file is imported
> creating the temp table
> 4. A procedure is run the takes my active data(an existing table) and
> archives(appends) that data to an archive table. Before this though the
> data in the archive table needs to be deleted.
> 5. The data from my live table is deleted.
> 6. Data from my imported temp table is appended to the live table.
> 7. Temp table is deleted.
> I read some stuff about DTS packages but I'm not real familiar with SQL
> Server and don't know how exactly to call the DTS package from my
> application and/or if DTS is actually the way to go. The text file is
> delimited and contains field names that will map directly to my existing
> tables. Not looking for a hand out so if you could get me pointed in the
> right direction I'm not against doing more research, but at this time I'm
> not exactly sure where to start. Thanks again for your time.
>
>|||John, Thanks very much for you quick response. I will look BOL some more.
You mention a website with lots of info but forgot the link. Take care!
Reggie
"John Bell" <jbellnewsposts@.h0tmail.com> wrote in message
news:4097B1F5-B1F6-434F-A14B-593AC227135F@.microsoft.com...
> Hi
> The following web site has lots of information on DTS. There is also alot
> of
> information in Books online (which can be downloaded from
> http://www.microsoft.com/downloads/...&displaylang=en
> if you don't have it!). You may also want to look up BCP or Bulk Insert as
> a
> alternative method.
> John
> "Reggie" wrote:
>|||Hi
Sorry anbout the missing link! http://www.sqldts.com/default.aspx?6
If you don't want the user to wait around for the file to load then you can
schedule your DTS package to run at intervals. Look at the looping example o
n
how to load all files in a given directory.
If you want to load immediately and know the destination file name, bulk
insert may also be an option. You may need use UNC addresses to get/put the
file into an accessible location.
John
"Reggie" wrote:
> John, Thanks very much for you quick response. I will look BOL some more
.
> You mention a website with lots of info but forgot the link. Take care!
> Reggie
> "John Bell" <jbellnewsposts@.h0tmail.com> wrote in message
> news:4097B1F5-B1F6-434F-A14B-593AC227135F@.microsoft.com...
>
>
Monday, March 26, 2012
Importing tables/cells into another database
(I got both installed and afraid If I take 2000 off the classifieds will no
longer function).
Anyway, I want to put a forum on the site also.
The setup includes a scrip to create al the tables for the new database.
I would rather use the original database with the users on it and modify it
some way so that I can continue to have current users on the new forum.
Is there a way to simplify a merge between these two?
I am guessing I will have to modify the forum software to look for the
element names of user/password for the classifieds database.
Thanks for any help, hints or tips.
GB
hi,
GeekBoy wrote:
> I am running a web site that that classifieds and using MS SQL 2000
> or 2005 (I got both installed and afraid If I take 2000 off the
> classifieds will no longer function).
> Anyway, I want to put a forum on the site also.
> The setup includes a scrip to create al the tables for the new
> database.
> I would rather use the original database with the users on it and
> modify it some way so that I can continue to have current users on
> the new forum.
> Is there a way to simplify a merge between these two?
>
without elements such as table design it's actually impossible to answer to
this one..
you can probably "add" you old users into the new database model, but,
again, it's impossibile to answer without elements
> I am guessing I will have to modify the forum software to look for the
> element names of user/password for the classifieds database.
>
you probably will, and I'd guess it'll not work at all if you just maintain
the old database you already have.. just a bet...
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz http://italy.mvps.org
DbaMgr2k ver 0.21.0 - DbaMgr ver 0.65.0 and further SQL Tools
-- remove DMO to reply
|||"Andrea Montanari" <andrea.sqlDMO@.virgilio.it> wrote in message
news:5ealvmF37mtgoU1@.mid.individual.net...
> hi,
> GeekBoy wrote:
> without elements such as table design it's actually impossible to answer
> to this one..
> you can probably "add" you old users into the new database model, but,
> again, it's impossibile to answer without elements
> you probably will, and I'd guess it'll not work at all if you just
> maintain the old database you already have.. just a bet...
>
Well it seems it is a bit more complicated than that. The passwords on the
database for the forum are encrypted.
Any more suggestions on how to use both?
Thanks for the kind reply so far.
|||hi,
GeekBoy wrote:
> Well it seems it is a bit more complicated than that.
:D you can take it for granted :D
>The passwords
> on the database for the forum are encrypted.
> Any more suggestions on how to use both?
>
you can't for sure "use both".. you "coul'd" transfer users (and encrypted
pwds) to the "new" user's table via a "traditional" INSERT INTO .. SELECT
statement, but you obviously have to consider the metadata difference of the
2 tables... if the 2 designs are quiet "close", you can probably get it
done, but if they strongly differ you'll get in troubles..
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz http://italy.mvps.org
DbaMgr2k ver 0.21.0 - DbaMgr ver 0.65.0 and further SQL Tools
-- remove DMO to reply
|||"Andrea Montanari" <andrea.sqlDMO@.virgilio.it> wrote in message
news:5ecnouF38c1sbU1@.mid.individual.net...
> hi,
> GeekBoy wrote:
> :D you can take it for granted :D
> you can't for sure "use both".. you "coul'd" transfer users (and encrypted
> pwds) to the "new" user's table via a "traditional" INSERT INTO .. SELECT
> statement, but you obviously have to consider the metadata difference of
> the 2 tables... if the 2 designs are quiet "close", you can probably get
> it done, but if they strongly differ you'll get in troubles..
> --
what about making 2 tables in the same database?
Then making a routine for writing user name and password into other
database?
> Andrea Montanari (Microsoft MVP - SQL Server)
> http://www.asql.biz http://italy.mvps.org
> DbaMgr2k ver 0.21.0 - DbaMgr ver 0.65.0 and further SQL Tools
> -- remove DMO to reply
>
Monday, March 12, 2012
Importing data using WebService
i'm searching a way to update data using a web service.
For example, i want to store the temprature of cities in a database. I have a table with all the cities and an other table storing the temperature.
I have access to à web service that give temperature for the cities...
i hope you understand what i want to do... ;-)
thanks a lotThe web service task can access the web service and store the SOAP envelope as an XML file locally. You can then access the XML file in a data flow task using the XML Source Adapter and use the data in your data-flow as you would any other data.
-Jamie|||Ok !
Where can i find a tutorial for using webservice task ?|||BOL should always be your first port of call. Try ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/extran9/html/5c7206f1-7d6a-4923-8dff-3c4912da4157.htm and if there isn't enough there to help use the "Send Feedback" link.
-Jamie|||It's not clear from the question whether the web service gives you address for a specific city or for all cities. Likely it's the former in which case you'd likely want to call the web service through the script component that wraps the SOAP call and does a little of it's own caching to avoid redundant web service calls.
If the shoe fits, feel free to wear it.|||Hi all,
I am using the web service task with XML source to insert data from a web service into an SQL Server database. But I have a problem with the XML output from the Web Service Task. It looks li this:
<?xml version="1.0" encoding="utf-16"?>
<ArrayOfBooking xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<Booking>
<BookingDate xmlns="http://tempuri.org/">2007-04-12T16:14:33.9210023+03:00</BookingDate>
<FlightDate xmlns="http://tempuri.org/">2007-04-12T16:14:33.9210023+03:00</FlightDate>
</Booking>
<Booking>
<BookingDate xmlns="http://tempuri.org/">2007-04-12T16:14:33.9210023+03:00</BookingDate>
<FlightDate xmlns="http://tempuri.org/">2007-04-12T16:14:33.9210023+03:00</FlightDate>
</Booking>
</ArrayOfBooking>
and because of this xmlns="http://tempuri.org/" that is met almost everywhere I cannot create a proper XSD Schema , that is needed for the XML source. If I remove this xmlns="http://tempuri.org/" , then everything works fine . The web service I am calling has this namespace xmlns="http://tempuri.org/" in the [WebService(Namespace = "http://tempuri.org/")] . I am writing the web service so I can change it as well if this is needed. Do you have any ideas how to solve this xmlns="http://tempuri.org/" problem?
Thanks in advance.
Regards,
pc
Importing data using WebService
i'm searching a way to update data using a web service.
For example, i want to store the temprature of cities in a database. I have a table with all the cities and an other table storing the temperature.
I have access to à web service that give temperature for the cities...
i hope you understand what i want to do... ;-)
thanks a lotThe web service task can access the web service and store the SOAP envelope as an XML file locally. You can then access the XML file in a data flow task using the XML Source Adapter and use the data in your data-flow as you would any other data.
-Jamie|||Ok !
Where can i find a tutorial for using webservice task ?|||BOL should always be your first port of call. Try ms-help://MS.SQLCC.v9/MS.SQLSVR.v9.en/extran9/html/5c7206f1-7d6a-4923-8dff-3c4912da4157.htm and if there isn't enough there to help use the "Send Feedback" link.
-Jamie|||It's not clear from the question whether the web service gives you address for a specific city or for all cities. Likely it's the former in which case you'd likely want to call the web service through the script component that wraps the SOAP call and does a little of it's own caching to avoid redundant web service calls.
If the shoe fits, feel free to wear it.|||Hi all,
I am using the web service task with XML source to insert data from a web service into an SQL Server database. But I have a problem with the XML output from the Web Service Task. It looks li this:
<?xml version="1.0" encoding="utf-16"?>
<ArrayOfBooking xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" >
<Booking>
<BookingDate xmlns="http://tempuri.org/">2007-04-12T16:14:33.9210023+03:00</BookingDate>
<FlightDate xmlns="http://tempuri.org/">2007-04-12T16:14:33.9210023+03:00</FlightDate>
</Booking>
<Booking>
<BookingDate xmlns="http://tempuri.org/">2007-04-12T16:14:33.9210023+03:00</BookingDate>
<FlightDate xmlns="http://tempuri.org/">2007-04-12T16:14:33.9210023+03:00</FlightDate>
</Booking>
</ArrayOfBooking>
and because of this xmlns="http://tempuri.org/" that is met almost everywhere I cannot create a proper XSD Schema , that is needed for the XML source. If I remove this xmlns="http://tempuri.org/" , then everything works fine . The web service I am calling has this namespace xmlns="http://tempuri.org/" in the [WebService(Namespace = "http://tempuri.org/")] . I am writing the web service so I can change it as well if this is needed. Do you have any ideas how to solve this xmlns="http://tempuri.org/" problem?
Thanks in advance.
Regards,
pc
Friday, March 9, 2012
Importing data from web page into SQL Server table
I have to find a way to do the following : a company provides for my company a web page displaying data separated with ;
I need to automatically update a table in SQLServer with this data, ie delete the old data, read the web page containing new data as text, and insert these data into the table.
I would actually prefer not to trigger this import process "by hand" ; if there's a solution to schedule it ...
Thanks for your help
JohannYes you can get the content of the page dynamically by using the server.execute then put the content in a text file and read the stream|||Thanks for your help
The problem is that the page containing the data is not mine. I have no control over it, and it's on another server.
All I have is the url to display that page in a browser. So, can I direct a script to that url and make my script read the content ?
Thanks
Johann|||does not matter if you haven't got this page in your server with the server.execute you can capture the html code then play with then pragmatically follow this link with some exampleshttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemwebhttpserverutilityclassexecutetopic.asp
Friday, February 24, 2012
Importing CVS to SQLServer 2005 in a web application
Importing CVS to SQLServer 2005 in a web application:
I need to import CSV file to a table. This is a .Net 2.0 web application running in the WebServer which has .Net 2.0 installed. SQL Server 2005 is a database in another machine. What are my options? Would SSIS work in WebServer if no database installed in that machine.
Thanks
>>.Importing CVS to SQLServer 2005 in a web application: << Do you mean CSV?
>>Would SSIS work in WebServer if no database installed in that machine.<< is SQL client and SQL Management studio was installed on the web server and you could log on to the web server.
>>What are my options? << You have specified if this is a on-off import or a regular job. One way of handling it would be to convert the csv to either a series in inserts to the table or calls to a stored procedure to do the job.
importing an excel file and save data into a database in my web account
Hi everyone, sorry if this message is not supposed to be posted here.
I'm learning asp.net , and would like to know how I can insert data from a excel file into a database on my web account. Pretty much insert/update information in the database using excel file or a access file.
Thanks a lot in advance
Checkout thses links:
http://support.microsoft.com/kb/311731
http://www.msdner.com/forum/thread302753.html
http://support.microsoft.com/kb/316934
http://www.vbdotnetheaven.com/UploadFile/mahesh/AccessExcelDatabase04252005014321AM/AccessExcelDatabase.aspx
I hope they will help.
Good luck.
|||
Thanks a lot. I found an interesting article that talks about this. again thanks for your assistance
|||If my post was helpful for your then please mark it as answer.
If not, please share the answer with us in a post and mark it as answer.
Remeber we have to cooperate to help each other.
Thanks and you are welcome.
Sunday, February 19, 2012
Importing Access database into SQLExpress
I am trying to complete a lab in the Microsoft self-paced training kit, Developing Web Applications with Microsoft Visual C# .NET.
They have provided an Access database named Contacts.mdb and a batch file named InstContacts.bat that uses InstContacts.sql to import the data.
I have installed SQLExpress, but when I run the batch file I get the following:
C:\Microsoft Press\...\data>rem The following command line installs the Contact SQL database
C:\Microsoft Press\...\data>osql -i InstContacts.Sql -E
[SQL Native Client]Named Pipes Provider: Could not open a connection to SQL Server [2].
[SQL Native Client]Login timeout expired
[SQL Native Client]An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.
Nevermind, I found the answer here.
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=421593&SiteID=1
Importing a word document into SQL Server
Does anyone know how I can import a word document into SQL server so
that it can be searchable using a web page (coldfusion or PHP)?
Or if anyone knows a simple way to make a word document searchable from
a web page, that would be great. Thanks!You would be better off using Index Server for this. Storing the document
in the database makes it no more searchable from a web page than would
storing the document on disk.
<simojo@.gmail.com> wrote in message
news:1139438036.600958.34280@.g43g2000cwa.googlegroups.com...
> Hey all,
> Does anyone know how I can import a word document into SQL server so
> that it can be searchable using a web page (coldfusion or PHP)?
> Or if anyone knows a simple way to make a word document searchable from
> a web page, that would be great. Thanks!
>
Importing a script into SQL Server Express
Msg 911, Level 16, State 1, Server ORTHANC\SQLEXPRESS, Line 1I have added access permissions for the ASPNET user account on the SQL Server Express folder but that doesn't appear to have helped. I'm not sure if the error about contacts.mdf means that I should have a contacts.mdf created as a result of the script or whether it should be there to begin with.
Could not locate entry in sysdatabases for database 'Contacts'. No entry found with that name. Make sure that the name is entered correctly.
Msg 15401, Level 16, State 1, Server ORTHANC\SQLEXPRESS, Line 1
Windows NT user or group 'ORTHANC\SQLEXPRESS\ASPNET' not found. Check the name again.
Msg 15410, Level 11, State 1, Server ORTHANC\SQLEXPRESS, Procedure sp_addrolemember, Line 80
User or role 'aspnet' does not exist in this database.
Msg 15410, Level 11, State 1, Server ORTHANC\SQLEXPRESS, Procedure sp_addrolemember, Line 80
User or role 'aspnet' does not exist in this database.
I found this threadhttp://forums.asp.net/thread/433540.aspx but it didn't solve my problem.
Apologies for the length of the post. Any help at all is greatly appreciated!
I think we are going to neeed to see the script you are trying to run.|||The script is the the one from the MCSD Web apps book. After installation off the CD it's available from C:\Microsoft Press\MCSDWebApps2\Databases. Leaving out the test data added at the bottom of the script it looks like this:
USE master
GO
if exists (select * from sysdatabases where name='Contacts')
drop database Contacts
go
DECLARE @.device_directory NVARCHAR(520)
SELECT @.device_directory = SUBSTRING(phyname, 1, CHARINDEX(N'master.mdf', LOWER(phyname)) - 1)
FROM master.dbo.sysdevices
WHERE (name = N'master')
EXECUTE (N'CREATE DATABASE Contacts
ON PRIMARY (NAME = N''Contacts'', FILENAME = N''' + @.device_directory + N'contacts.mdf'')
LOG ON (NAME = N''Contacts_log'', FILENAME = N''' + @.device_directory + N'contacts.ldf'')')
go
exec sp_dboption'Contacts','trunc. log on chkpt.','true'
exec sp_dboption'Contacts','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"Contacts"
GO
/****** Object: Table [dbo].[Calls] Script Date: 3/7/2002 1:52:49 PM ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Calls]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Calls]
GO
/****** Object: Table [dbo].[Contact Types] Script Date: 3/7/2002 1:52:49 PM ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Contact Types]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Contact Types]
GO
/****** Object: Table [dbo].[Contacts] Script Date: 3/7/2002 1:52:49 PM ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Contacts]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Contacts]
GO
/****** Object: Table [dbo].[Calls] Script Date: 3/7/2002 1:52:51 PM ******/
CREATE TABLE [dbo].[Calls] (
[CallID] [int] NOT NULL ,
[ContactID] [int] NOT NULL ,
[CallDate] [datetime] NULL ,
[CallTime] [datetime] NULL ,
[Subject] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Notes] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
GRANT REFERENCES , SELECT , INSERT , DELETE , UPDATE ON"Calls" TO"public"
GO
/****** Object: Table [dbo].[Contact Types] Script Date: 3/7/2002 1:52:55 PM ******/
CREATE TABLE [dbo].[Contact Types] (
[ContactTypeID] [int] NOT NULL ,
[ContactType] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
GRANT REFERENCES , SELECT , INSERT , DELETE , UPDATE ON"Contact Types" TO"public"
GO
/****** Object: Table [dbo].[Contacts] Script Date: 3/7/2002 1:52:55 PM ******/
CREATE TABLE [dbo].[Contacts] (
[ContactID] [int] NOT NULL ,
[FirstName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[LastName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Dear] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Address] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[City] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[StateOrProvince] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[PostalCode] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Region] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Country] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[CompanyName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Title] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[WorkPhone] [nvarchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[WorkExtension] [nvarchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[HomePhone] [nvarchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[MobilePhone] [nvarchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[FaxNumber] [nvarchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[EmailName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Birthdate] [smalldatetime] NULL ,
[LastMeetingDate] [smalldatetime] NULL ,
[ContactTypeID] [int] NULL ,
[ReferredBy] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[Notes] [ntext] COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[ContactsInterests] [nvarchar] (255) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
GRANT REFERENCES , SELECT , INSERT , DELETE , UPDATE ON"Contacts" TO"public"
GO
DECLARE @.srv varchar(100)
SET @.srv = @.@.SERVERNAME +'\ASPNET'
if not exists (select * from dbo.sysusers where name = N'aspnet' and uid < 16382)
EXEC sp_grantdbaccess @.srv, N'aspnet'
GO
if not exists (select * from dbo.sysusers where name = N'guest' and uid < 16382 and hasdbaccess = 1)
EXEC sp_grantdbaccess N'guest'
GO
exec sp_addrolemember N'db_datareader', N'aspnet'
GO
exec sp_addrolemember N'db_datawriter', N'aspnet'
GO
ALTER TABLE [dbo].[Calls] WITH NOCHECK ADD
CONSTRAINT [PK__Calls__59063A47] PRIMARY KEY CLUSTERED
(
[CallID]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Contact Types] WITH NOCHECK ADD
CONSTRAINT [PK__Contact Types__5AEE82B9] PRIMARY KEY CLUSTERED
(
[ContactTypeID]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[Contacts] WITH NOCHECK ADD
CONSTRAINT [PK__Contacts__5CD6CB2B] PRIMARY KEY CLUSTERED
(
[ContactID]
) ON [PRIMARY]
GO
How are you going about running it for your SQL Express database?|||
There's a batch file in the folder that runs the following command:
osql -i InstContacts.Sql -E
That produces the same errors if I use the more up to date sqlcmd with this command line:
sqlcmd -S orthanc\sqlexpress -i c:\contacts.sql -o result.txt
The first error refers to "contacts.mdf" and suggests that the name is incorrect. Should I have a contacts.mdf file or is it created by the script when it executes correctly?