Not Able To Create DB Objects From Vb Script

Oct 4, 2007



Hi All,
I have a SQL script which has creation of some table variables. When I run this query in Query Analyzer, I get proper results. But, when I use the same script to execute from VB Script, it is not running at all. I tried a simple select statement which works fine; but with the one I want to run, it fails to run. I am trying to print the SQL script from VB script, and it appears to be fine. I think the creation of DB objects is where it is getting stuck. Any help here please??

Below is the SQL Script.





Code Block
DECLARE @COMPSINGRP TABLE (NAME VARCHAR(100))
INSERT INTO @COMPSINGRP SELECT NAME FROM COMPUTER WHERE IDCOMPUTER IN (SELECT INSTANCEID FROM [FN_COMPUTERSINGROUPLIKENAME] ('UBS: APPLICATIONS - DEALAXIS') )
DECLARE @COMPRESTARTS TABLE (NAME VARCHAR(100))
INSERT INTO @COMPRESTARTS SELECT COMPUTER FROM (
SELECT C.Name AS COMPUTER, --- FIRST COLUMN
(SELECT AC.Description FROM Computer CC
INNER JOIN [fn_ComputersInGroupLikeName] ('UBS: Applications - DealAxis') CCG ON CC.idComputer = CCG.InstanceID
INNER JOIN Alert AC ON CCG.InstanceID = AC.idComputer
WHERE (AC.Description Like '%down on a scheduled maintenance%')
AND
CC.Name = C.Name
AND
(CONVERT(NVARCHAR(12),A.TimeOfLastEvent,111) = CONVERT(NVARCHAR(12),GETDATE(),111) )) AS DOWN_DESCRIPTION, --- SECOND COLUMN
(SELECT AC.Description FROM Computer CC
INNER JOIN [fn_ComputersInGroupLikeName] ('UBS: Applications - DealAxis') CCG ON CC.idComputer = CCG.InstanceID
INNER JOIN Alert AC ON CCG.InstanceID = AC.idComputer
WHERE (AC.Description Like '%successfully up now after a scheduled reboot%' )
AND
CC.Name = C.Name
AND
(CONVERT(NVARCHAR(12),A.TimeOfLastEvent,111) = CONVERT(NVARCHAR(12),GETDATE(),111) ) ) AS UP_DESCRIPTION --- THIRD COLUMN
FROM Computer C
INNER JOIN [fn_ComputersInGroupLikeName] ('UBS: Applications - DealAxis') CG ON C.idComputer = CG.InstanceID
INNER JOIN Alert A ON CG.InstanceID = A.idComputer
WHERE (CONVERT (NVARCHAR(12),A.TimeOfLastEvent,111) = CONVERT(NVARCHAR(12),GETDATE(),111) )
--ORDER BY C.NAME
) AS RESTARTS
DECLARE @NOCLUE TABLE (NAME VARCHAR(100))
SELECT 'The Server '+ NAME+' did not have any restart information. Please Check.' FROM @COMPSINGRP WHERE NAME NOT IN (SELECT NAME FROM @COMPRESTARTS)


Any help or suggestion would help me out. Thanks a lot.

Mannu.


View 2 Replies


ADVERTISEMENT

How To Have Developers Create Objects

Jun 28, 2000

I will have a group of developers creating objects in a database. Currently they all
create them with the SA account. I would like to have them mapped to the dbo or some method
that when they create objects all objects are dbo.object name and not h1fed99.object name.
Is there a good methor or practice to handle this

View 1 Replies View Related

Error While Create DB Objects

Feb 25, 2008

My website host allows me to create DB and DB users from its control panel and then I am able to use SQL server Management studio to Manage My DB.
Therefore I create My DB (TBC20) and create a user for it(Tony) from Host Panel.
When I want to Export My Local copy DB data to the remote DB using Import/Export wizard and set the It won’t Generate any DB objects. Even When I use aspnet_regsql Command I encounter Following error:
SQL error number is 262 and the SqlException message is: CREATE DATABASE permiss
ion denied in database 'master'.
Creating the TBC20 database...
------------------------------------------------------
When I View permissions in Database properties window No Permission is Grant for user: Tony. Only some permission Grant for Grantor: dbo. When I check Boxes to Grant Permission for user Tony None of permissions will be grant to this user.
How could I allow this user ti take ownership of DB and create DB objects

View 3 Replies View Related

Using SqlCmd To Create Objects In CE

Jun 20, 2007

Hi, can we use sqlcmd.exe (successsor to osql) to run sql scripts against a compact edition database? Would like to use the output from Visual Studio Team Edition for Software Professionals to build the database structure on compact edition database.

thanks,

dan

View 4 Replies View Related

How To Get Information About Create/drop Objects?

Oct 2, 2000

How to SQL server save information about create/drop objects action. How can I get this? Example for, a lot of objects(sp) in my database has been dropped, how I know who was dropped them (user login & time)?

View 1 Replies View Related

Can't Create Or Edit Existing Objects From SQL SRV 7.0

May 4, 1999

Hello,

I just upgraded our existing 6.5 installation with the new SQL server 7.0. I can't get any of the existing stored procedures which I imported from 6.5 into 7.0 to allow me to edit them. I do all of my design from Visual InterDev and the SQL Server 6.5 version would allow me to create and edit stored procedures. It would also allow me to create/design new tables.

With SQL Server 7.0 I do not have an option to edit or create any of these items. I have created a new login, assigned it a password, given it admin rights/roles and I am still unable to remotely create these items. What am I doing wrong?

Thanks for any assistance
Doug

View 1 Replies View Related

Create SQL Server Objects From Command Prompts

Jan 15, 2005

Hi

Is there any why to Create SQL Server Objects from Command Prompts like (Databases , Tables, Stored Procedures, …) ??

If you will Install some Applications Like this forums you will see the SQL Server object Created from Command Prompts

How Can I do that .. ??

And thanks with my regarding

Fraas

View 1 Replies View Related

How To Create The ER Diagram For SQL Server Database Objects

Dec 15, 2006

Hi,I have to prepare an ER diagram for the objects in my SQL Serverdatabase. I have used the option "DIAGRAMS" in EnterPrise Manager ofSQL Server 2000. It is creating the diagram for the selected tables(but the diagram contains only the table which i have selected. It isnot displaying its depended tables). But i am not able to export it toany of the flat file like MS WORD or paint. I want this diagram to beuploaded to one Flat file and send to my customer for his reference.Could anyone suggest me how to create the ER Diagram for the SQL 2000database and export it to a flat file.Thanks for your help in advance.-Rao

View 2 Replies View Related

Retrieving 'CREATE' Statements For Database Objects

May 6, 2008

MySql has a statement like:
SHOW CREATE TABLE tablename;

that returns the precise CREATE TABLE statement for the specified tablename.

Sql Management Studio also allows scripting Create Statement for any object by right-clicking it.
But I want to do this programatically, and fetch CREATE statements for Tables, Procedures & Views.

How can I retrive CREATE statements for Database objects progrmatically in Sql Server???

View 9 Replies View Related

Scripting Create To File For Multiple Objects

Aug 22, 2007

What would be the best way to create a routine that performs the "Script <object> as Create To File" for multiple objects in my database??

I would like a separate file for each object (table, view, or stored procedure).

Could someone point me in the right direction??

Thanks,

Paul

View 1 Replies View Related

Is There A Way To Give Someone The Right To Create Only Views And No Other Objects In A Database

Feb 25, 2008

Is there a way to give someone the right to create only views and no other objects in a database? Currently I have given the individual ddladmin database rose, but would rather be more restrictive?

View 1 Replies View Related

How Can I Automatic Create All That Objects In Assembly In Simple Way ??

Jan 12, 2006

Hi
 
I use SQL code snippet to attach the CLR assembly (dll) to the SQL Server Express
 
CREATE ASSEMBLY [DatabaseAndImages]
AUTHORIZATION [dbo]
FROM 'C:CLR_File.dll'
WITH PERMISSION_SET = SAFE
 
That file content CRL Codes for 10 Stored Procedures & 3 UDT & 5 Functions & 6 Triggers
As you can see it's content large amount of DB objects !!
 
My Question is ..
Is there any simple way can I use it to extract or automatic create all that Objects in the Database without use separate SQL Statement for each one ??
 
By Example , I will use this SQL statement to create the sp_AddImage that already located inside the CLR dll file
 
CREATE PROCEDURE [dbo].[sp_AddImage]
       @ImageID [uniqueidentifier],
       @ImageFileName [nvarchar](max),
       @Image [varbinary](max)
WITH EXECUTE AS CALLER
AS
EXTERNAL NAME [DatabaseAndImages].[StoredProcedures].[sp_AddImage]
 
 
But as you know .. I have many objects .. and I am in development phase and I will do change to that object many time and also may I will add much more €¦
 
I thing it's not good to write SQL Statement for each object and do changes every time when I change the object definition
 
Is there any one line of SQL statement can I use it to automatically create and extract all the objects inside the assembly ??
Or is there any way to do that Issue by simple operation ??
 
 
And thanks with my best regarding
Fraas

View 3 Replies View Related

Why VS2005 Create Partial Class For SQLCLR Objects

Jul 4, 2007

I have noticed that VS2005 create partial class for SQLCLR objects(Stored Procedure, UDF , ecc.)

Is this partial need ?

Here http://technet.microsoft.com/en-us/library/ms345135.aspx is shown an example that do not use partial attribute.



Many thanks

Claudio



View 1 Replies View Related

Create SSIS Package To Script Out DB Objects (1 File Per Object)

Nov 29, 2007

We are in the process of trying to automate our production releases (what a concept ;-)

The database is SQL server 2005
All objects are being stored in VSS
Using Nant and Cruise Control for the actual migrations.
I have two directories - Create (for a brandnew database) and Change (db object changes)

In my 'Change' script, I do the following -

1 - Take backup of database
2 - Migrate objects from 'change' directory to production
3 - Script out all objects of database and save in the 'Create' directory

For the #3, I was hoping I could create an SSIS package that would
script out all database objects and save them on the VSS server.

I'm new to SSIS and want to verify it's something that can be done before I start down that path.
If anyone has any examples or references, it would be much appreciated.

Thanks

View 4 Replies View Related

DB Engine :: Does Logon Trigger Create Internal Temporary Objects

Jun 4, 2015

I create a logon trigger on a sql server 2008 r2 instance,the trigger is very simple,like this:

CREATE TRIGGER tg_login
ON ALL SERVER
FOR LOGON
AS
IF ORIGINAL_LOGIN() IN('sa') AND HOST_NAME()='TestHost1'

[Code] ...

I use master.dbo.LoginRecord  table to record the bad logon. When the trigger is working ,latches produced sometimes,wait type is PAGELATCH_UP  and wait resource is 2:1:3. At this time, a large number of logon failed ,error message is  "Logon failed for login 'login name' due to trigger execution."

I think  logon trigger create internal temporary objects maybe,it is right?

View 13 Replies View Related

Putting Names Of Objects To Control-flow Loop Creating Objects

Dec 27, 2006

please help newbieI need to create a lot of objects the same type (let's say: schemas)I wish to use paramerized block in loop to do so.- how to put names of my objects to such control-flow?belss you for help

View 5 Replies View Related

Can Create Alias Server1DBInstance1 On Server3DBInstance3 And Assign Objects To That Alias

Nov 24, 2015

We will be moving 2 different databases (SS2005 & SS2008) to a new SS2014 SQL Server.  Currently our codes looks something like Server1DBInstance1... & Server2DBInstance2... Is it possible to move the objects from these 2 instances to Server3DBInstance3 and then use an alias to reference the objects?  Or does Server3 need to have DBInstance1 & DBIstance2?  Basically, is the alias just for the database or for the instance too?  Can I create an alias "Server1DBInstance1' on Server3DBInstance3 and assign objects to that alias?

View 16 Replies View Related

SQL Server 2012 :: Select Data From XML - Objects Within Objects?

Nov 20, 2013

passing serialised objects to a stored procedure for the purpose of data inserts. I see this as being a way to handle multiple row inserts efficiently.

However, in my limited use of XML data I am not so sure how to link the data when I have a dependency on another "object" within the serialised XML.

Below is a code snippet showing what I have so far.

The first insert statement works fine - but how to retrieve the identifier created by the DB - I want to use an SQL statement that finds the record in the table based on the XML representation (of the PluginInfo), allowing me to insert the ConfigurationInfo with the correct reference to the PluginInfo

DECLARE @Config NVARCHAR(MAX)
DECLARE @Handle AS INT
DECLARE @TransactionCount AS INT
SELECT @Config = '
<ConfigurationDirectory >
<ConfigurationInfo groupKey="Notifications" sectionKey="App.Customization.PluginInfo"

[code]....

View 1 Replies View Related

OLE Objects

Aug 27, 2001

Hi, there,

I use VB to make an dll file and register on my local PC, then use sp_OACreate to create OLE object on local SQL server, it works fine. But when I register that dll on other SQL server, it dosen't work, anybody have idea about this? Thank you.

Tony

View 1 Replies View Related

How To Use Objects??

Jul 17, 2000

I see these type of objects in Books on Online. I was just wondering
if anyone knows how to use these objects, seems to have lot of good
information. Could these objects be called in VB?

--------------------------------
CreateDate Property (SQL-DMO)
The CreateDate property indicates the date and time the referenced SQLServer object was created.

Applies To
Database Object Table Object
DBObject Object TransactionLog Object
Default Object Trigger Object
Rule Object View Object
StoredProcedure Object


Syntax
object.CreateDate

Part Description
object Expression that evaluates to an object in the Applies To list


Remarks
The string returned is formatted by using the locale setting of the workstation.

Data Type
String

Modifiable
Read-only

Prototype (C/C++)
HRESULT GetCreateDate(SQLDMO_LPBSTR pRetVal);
--------------------------------------------------------

View 1 Replies View Related

Sys.objects

Sep 21, 2007



Anyone know how to grant a user to see all data in sys.objects view?

Thanks.

View 1 Replies View Related

Sys.objects

Sep 21, 2007



Anyone know how to grant a user (who is not a sa) to see all data in sys.objects view?

Thanks.

View 1 Replies View Related

COM Objects Under 64-bit?

Jan 25, 2007

Hi everyone,
 
Primary platform is Framework 2.0 under 32-bit
Production platform will be Framework 2.0 under 64-bit.
 
I'm concerned about what object should I use in order to launch DTS 2000/7.0 from our .Net service.
 
Currently it tested fine from a 32-bit environment (sql server 2005 as backend).
 
Reference: "Microsoft DTSPackage Object Library"
Physical file:  dtspkg.dll
 
My wonder,  is there any limitation when it's gonna to work on 64-bit?
 
Generally speaking, any limitation/issue/drawback for COM objects under 64 bit??
In my project properties appears Any CPU, x86, x64. I've got now Any CPU.
 
Thanks for your advices,
 
 

View 13 Replies View Related

Problems On Create Proc Includes Granting Create Table Or View Perissinin SP

Aug 4, 2004

Hi All,

I'm trying to create a proc for granting permission for developer, but I tried many times, still couldn't get successful, someone can help me? The original statement is:

Create PROC dbo.GrantPermission
@user1 varchar(50)

as

Grant create table to @user1
go

Grant create view to @user1
go

Grant create Procedure to @user1
Go



Thanks Guys.

View 14 Replies View Related

Boolean: {[If [table With This Name] Already Exists In [this Sql Database] Then [ Don't Create Another One] Else [create It And Populate It With These Values]}

May 20, 2008

the subject pretty much says it all, I want to be able to do the following in in VB.net code):
 
{[If [table with this name] already exists [in this sql database] then [ don't create another one] else [create it and populate it with these values]}
 
How would I do this?

View 3 Replies View Related

Create Variable To Store Fetched Name To Use Within BEGIN / END Statements To Create A Login

Mar 3, 2014

I created a cursor that moves through a table to retrieve a user's name.When I open this cursor, I create a variable to store the fetched name to use within the BEGIN/END statements to create a login, user, and role.

I'm getting an 'incorrect syntax' error at the variable. For example ..

CREATE LOGIN @NAME WITH PASSWORD 'password'

I've done a bit of research online and found that you cannot use variables to create logins and the like. One person suggested a stored procedure or dynamic SQL, whereas another pointed out that you shouldn't use a stored procedure and dynamic SQL is best.

View 3 Replies View Related

Dynamic Create Table, Create Index Based Upon A Given Database

Jul 20, 2005

Can I dynamically (from a stored procedure) generatea create table script of all tables in a given database (with defaults etc)a create view script of all viewsa create function script of all functionsa create index script of all indexes.(The result will be 4 scripts)Arno de Jong,The Netherlands.

View 1 Replies View Related

Closing ADO Objects

Apr 4, 2007

I know it's "best practice" to dispose ado.net objects, but does it make a big difference if just the connection is closed? In other words, is the code below good enough or should the DataAdapter & Command be explicitly closed?using (SqlConneciton  cn = new SqlConnection(connstr)){ SqlDataAdapter da = new SqlDataAdapter(sql,cn);DataSet ds = new DataSet();da.Fill(ds); SqlCommand cmd = new SqlCommand(someOtherSql,cn);cmd.ExecuteNonQuery();  } 

View 2 Replies View Related

Objects In SQL Server

Jun 16, 2008

Hi,
I am a Database called "Cache"  user and in it and when creating a new table I can create a column of type Object.
So basically, I can create an object eg. Address that have the following items StreetNo, StreetName, PCode somewhere in my database; then create a table called eg. Employees that have a column called EmployeeAddress of type Address (as my Address Object). Can this be done in SQL Server!?
 
 
Thanks. 

View 4 Replies View Related

Managed Objects

Mar 21, 2006

Hello people :-)I'm doing some development work with Visual Studio 2005 and SQLServer 2000. My SQL DB is running on a Windows 2000 Server box in the office, and I'm doing the development on my XPPro workstation. Now I've been trying to connect to the Win2000 box though VS and although I can see the server and the DB when I hit ok I get this error"The SQL server specified by these connection propertise does not support managed objects"What the heck does that mean?any help would be great :-)

View 1 Replies View Related

Protecting Objects From Even The SA

Feb 22, 2001

I am currently writing a VB app based around a SQLserver2000 database. I have used stored procedures wherever possible to select/update/delete data. I am planning to distribute this app and wonder whether there are any tricks out there for encrypting/setting security so that even the SA account would be unable to read my stored procedures, but obviously be able to execute them?

There are two scenarios - one is where I want to let someone borrow a laptop just for a few days for a demo. Presumably I just give them an unprivileged user account without interactive logon possibilities, by which I mean Enterprise Manager and the other SQLserver Client tools [can I do this?] and control all access from the app.

The other scenario is when the app is purchased and I no longer have control of the SQL Server nor the SA account.

Any pointers would certainly be very useful indeed. Thanks.

View 1 Replies View Related

Export Objects

Jan 2, 2002

Hi all, I know we can use DTS package to export or import objects from one db to another. Now I need to write a procedure that will perform similar functionality. Any thoughts on this? Thank you!

View 2 Replies View Related

Transfer/Objects

Jul 26, 2000

Hi,
I am in the process of upgrading database in sql server 6.5 to 7.0.
For that i am following one computer upgrade.
For creating dev environment in my computer i am using Transfer/Objects in 6.5
for transferring database from remote(production) computer to my computer.

Do i need only to transfer Userdatabase alone or do i need to Transfer Master and other ?
Or Is it better to restore dump ?


Thanks

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved