473,385 Members | 1,518 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Running SQL script through VB

Hi all,

I have generated a huge SQL script which installs the whole database
starting from creating database, tables,creating procedures, creating users
and everything thats required by my application.
Now i am using a custom action to install that database on my machine by
a deployment project for my application. It creates database and tables but
throws exceptions while creating procedures.
I am putting all the SQL code in a single txt file and reading it to
execute query.

1. Can I use a single file for all operations ?
2. What I need to do for the procedures and create users ?

Thnx

Nov 21 '05 #1
3 8745
Bontz,

1. Can I use a single file for all operations ?


I thought that it is not working or not recomended.

Use for every operation a command.executenonquery

However it is better to place this question in the newsgroup
microsoft.public.dotnet.framework.adonet

There are a lot of people active who know a lot of SQL coding and all active
ones are able to translate your question to VBNet.

I hope this helps

Cor
Nov 21 '05 #2
Hi,

http://www.microsoft.com/downloads/d...DisplayLang=en

http://www.red-gate.com/sql/sql_packager.htm

Ken
-------------------------------
"BONTZ" <BO***@discussions.microsoft.com> wrote in message
news:06**********************************@microsof t.com...
Hi all,

I have generated a huge SQL script which installs the whole database
starting from creating database, tables,creating procedures, creating users
and everything thats required by my application.
Now i am using a custom action to install that database on my machine by
a deployment project for my application. It creates database and tables but
throws exceptions while creating procedures.
I am putting all the SQL code in a single txt file and reading it to
execute query.

1. Can I use a single file for all operations ?
2. What I need to do for the procedures and create users ?

Thnx
Nov 21 '05 #3
Hi Joseph,

I am connecting through a default username (windows authentication) and my
setup is creating tables and users. So connection is not a problem.

The error I am getting while running a script (generated by SQL server
enterprise manager) was " 'Create Procedure' statement should appear on the
top of the module". I cut pasted the Create procedure code to the top of
script. Now the error is

create procedure dbo.dt_adduserobject
as
set nocount on
/*
** Create the user object if it does not exist already
*/
begin transaction
insert dbo.dtproperties (property) VALUES ('DtgSchemaOBJECT')
update dbo.dtproperties set objectid=@@identity
where id=@@identity and property='DtgSchemaOBJECT'
commit
return @@identity
SET QUOTED_IDENTIFIER OFF

SET ANSI_NULLS ON
GRANT EXECUTE ON [dbo].[dt_adduserobject] TO [public]
SET QUOTED_IDENTIFIER ON

SET ANSI_NULLS ON
Can you help me out ?

Thnx
"A use database statement is not allowed in a procedure or trigger"

whereAs in procedure I am nowhere using USE DATABSE statment. The code of my
create procedure is :


"Joseph Vinoth" wrote:
Hi,

I need two info from you to help

what is the error you are getting ?
which sql user are u connecting?

try with system abdministrator user name that is sa and the password

Regards
Joseph Vinoth
"Ken Tucker [MVP]" wrote:
Hi,

http://www.microsoft.com/downloads/d...DisplayLang=en

http://www.red-gate.com/sql/sql_packager.htm

Ken
-------------------------------
"BONTZ" <BO***@discussions.microsoft.com> wrote in message
news:06**********************************@microsof t.com...
Hi all,

I have generated a huge SQL script which installs the whole database
starting from creating database, tables,creating procedures, creating users
and everything thats required by my application.
Now i am using a custom action to install that database on my machine by
a deployment project for my application. It creates database and tables but
throws exceptions while creating procedures.
I am putting all the SQL code in a single txt file and reading it to
execute query.

1. Can I use a single file for all operations ?
2. What I need to do for the procedures and create users ?

Thnx

Nov 21 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Sticks | last post by:
ok... im not quite sure how to describe my problem. i have a php script that runs through my entire php site and writes the resulting output to html files. this is necessary as the nature of the...
4
by: Damien Renwick | last post by:
I have a php script which simply stops midway through a while loop that processes records returned by a MySQL query. The HTML page continues trying to load the page but the php has stopped running...
10
by: shumaker | last post by:
I don't need a detailed description of a solution(although I wouldn't mind), but I am hoping someone could tell me in general the best path to go about accomplishing a task, since I don't know all...
1
by: Ennio-Sr | last post by:
Hi all! Testing a script where I need to make sure that postgresql is running before passing a <psql dbasename -c "insert into ..." > instruction I faced this curious behaviour: This is the...
2
by: Benjamin Rutt | last post by:
I often execute a long-running python script which is a "driver" for my application; it may run for several hours on a large input. Under CPython, is it safe for me to modify the Python script...
1
by: Anonieko | last post by:
Query: How to display progress bar for long running page Answer: Yet another solution. REFERENCE: http://www.eggheadcafe.com/articles/20050108.asp My only regret is that when click the...
1
by: Aaron West | last post by:
Try this script to see what queries are taking over a second. To get some real output, you need a long-running query. Here's one (estimated to take over an hour): PRINT GETDATE() select...
5
by: This | last post by:
I have a pretty basic emailing script that sends a relatively small number (150) of html emails. The emails are compiled, personalised from a mysql db subscribers list, and sent using mail() -...
9
by: Scott | last post by:
What is the most reliable method to determine the folder a script is running in? I was looking at the globals in $_SERVER but all the variables also listed the actual file the script was running...
5
by: Christopher Brewster | last post by:
I am running the same script on the same data on two different machines (the folder is synchronised with Dropbox). I get two different results. All the script does is count words in different...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.