Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MS SQL Server


SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Need To Prevent Database Assembly Creation


On certain servers, I don't want developers to be able to create assemblies.
Unfortunately, the command

sp_configure 'clr enabled', 0

only prevents the CLR-type from being executed, not its creation.

I am unable to rename nor put triggers on
sys.assemblies,
sys.assembly_modules,
sys.assembly_files, and
sys.assembly_references .

I would prefer the user know the boundaries well before implementation.

Has anyone succeeded at this?




View Complete Forum Thread with Replies

Related Forum Messages:
ALTER ASSEMBLY Error Msg 6509 An Error Occurred While Gathering Metadata From Assembly ‘&&<Assembly Name&&>’ With HRESULT 0x1.
I work with February CTP of SqlServer 2008.
I have an Assembly with several UDTs inside. Version of assembly is 1.0.*
I use CREATE ASSEMBLY statement to register this assembly, and it runs without any errors. Then I rebuild CLR solution without doing any changes in source code. In that case the only difference between new and old assemblies is version (difference in fourth part of version).
Then I try to update assembly in SqlServer. I use
ALTER ASSEMBLY <name>
FROM <path>
WITH PERMISSION_SET = UNSAFE, UNCHECKED DATA
statement for this. Statement runs with error:
Msg 6509An error occurred while gathering metadata from assembly €˜<Assembly name>€™ with HRESULT 0x1.
I found the list of condition for ALTER ASSEMBLY in MSDN:
ALTER ASSEMBLY statement cannot be used to change the following:
·         The signatures of CLR functions, aggregate functions, stored procedures, and triggers in an instance of SQL Server that reference the assembly. ALTER ASSEMBLY fails when SQL Server cannot rebind .NET Framework database objects in SQL Server with the new version of the assembly.
·         The signatures of methods in the assembly that are called from other assemblies.
·         The list of assemblies that depend on the assembly, as referenced in the DependentList property of the assembly.
·         The indexability of a method, unless there are no indexes or persisted computed columns depending on that method, either directly or indirectly.
·         The FillRow method name attribute for CLR table-valued functions.
·         The Accumulate and Terminate method signature for user-defined aggregates.
·         System assemblies.
·         Assembly ownership. Use ALTER AUTHORIZATION (Transact-SQL) instead.
Additionally, for assemblies that implement user-defined types, ALTER ASSEMBLY can be used for making only the following changes:
·         Modifying public methods of the user-defined type class, as long as signatures or attributes are not changed.
·         Adding new public methods.
·         Modifying private methods in any way.
 
But I haven€™t done any changes in source code, so new version of assembly satisfies all this conditions.
What could be the reason for such behavior?
P.S. I€™ve got the same error, if I add or change any method in assembly before rebuilding.
 
 

View Replies !
Prevent From Copying Database ?
Hi,

How can prevent from stoping sql-server sevice and copying database,
note user has a access right to pc/server.

Kind Regards,
sasan.

View Replies !
How To Prevent The Insertion Of The Same Entry Of An Unique Value Into The Database
how to prevent the insertion of the same entry of an unique value into the database?
assume that I have a primary key username " abc"  in the database
and then I insert the "abc" again ,the debuggging error msg pops out saying the primary key cannot be duplicated..
how can I do an if--else statement to check the database against this unintentional inputs of the same unique data " abc"???
 

View Replies !
How To Prevent Database Drops In SQL Server 2000
 

Does anyone have a good strategy or technique for preventing database drops in SQL Server 2000?  I know in 2005 DDL triggers rock, but in 2000 what can you do to audit who drops a database why keeping the same permissions intact.
 
Jason

View Replies !
Prevent SQL Connections During Database Schema Upgrade
Hello,

We utilise SQL scripts, executed via sqlcmd.exe, to upgrade the schema and common data of our database(s) when we deploy new versions of our software to a production site. At the moment we simply wait until after hours to do the upgrade and ask nicely for all users to not use the system for a while.

Obviously, asking nicely doesn't always work, and there is also the issue of scheduled server tasks and web services / web sites that operate against the database 24/7.

What are our options for putting the entire server (or preferrably just one database) into a semi-offline state so that users and services cannot connect to it while our script connects and performs the upgrade? I imagine there may be several approaches each with their own pros and cons. 

If you could point me in the right direction or perhaps mention what strategy has worked for you, it would be greatly appreciated. We perform these upgrades from hundreds of kilometers away via VPNs and Remote Desktop so we can't just unplug the network cable :).

Thank you.

Regards,
 - Jason

View Replies !
How Prevent The Local Administrator To Read The Content Of The Database
 

Hi everybody,
 
I have an application in dotnet that uses sql express.
This application will be deployed on the user computer and I have to find a way to prevent the user to be able to read the data and access the structure of the database.
 
Is there a way to do this ? Even if the user is a local administrator of the computer ?
 
That's a difficult question, isn't it ? ;-))))
 
Thank you for your possible ideas,
 
Ciao,
 
Aurore
 
 

View Replies !
Msg 6573 Method, Property Or Field In Assembly Is Not Static. VB.Net Assembly In SQL Server Problem
 

I am trying to get a function I created in VB 5 for Access and Excel to work in SQL 2005. I was able to update the old VB code to work in VB 2005. I compiled and made a .dll, and I was able to register the new Assembly in SQL Server. When I try to create the Function, I get an error:
 

CREATE FUNCTION dbo.Temperature(@FluidName char, @InpCode Char, @Units Char, @Prop1 varchar, @Prop2 varChar)

RETURNS VarChar

AS EXTERNAL NAME FluidProps.[FluidProps.FluidProperties.Fluids].Temperature

 
Error returned:
 

Msg 6573, Level 16, State 1, Procedure Temperature, Line 21

Method, property or field 'Temperature' of class 'FluidProps.FluidProperties.Fluids' in assembly 'FluidProps' is not static.

 
 
Here is the code (part of it) in the VB class:
 
Header:
 

Imports Microsoft.SqlServer.Server

Imports System.Data.SqlClient

Imports System.Runtime.InteropServices

Imports System.Security

Imports System.Security.Permissions

 

 

Namespace FluidProperties



'Option Strict Off

'Option Explicit On

Public Partial Class Fluids
 
Function:
 

Function Temperature(ByRef FluidName As Object, ByRef InpCode As Object, ByRef Units As Object, ByRef Prop1 As Object, Optional ByRef Prop2 As Object = Nothing) As Object

Call CalcProp(FluidName, InpCode, Units, Prop1, Prop2)

Temperature = ConvertUnits("-T", Units, T, 0)

End Function
 

If I change the Function Temperature to Static, I get an error that functions cannot be Static. Its been a long time since I created the code and am having a hard time in my older age of getting the cobwebs out to make it work.
 
I have no problem getting the function to work if I call it from a VB form....so what do I need to do to get it to work on data in my SQL server?
 
Thanks
 
Buck

View Replies !
Creating A System.Management Assembly In Order For My Own Assembly To Work?
Hi

I am a bit paranoid about what I just did to my SQL Server 2005 with this CLR experiment.

I created a Class Lib in C# called inLineLib that has a class Queue which represents an object  with an ID field.

in another separate namespace called inLineCLRsql, I created a class called test which will hold the function to be accessed from DB,  I referenced and created an instances of the Queue class, and retrieve it's ID in a function called PrintMessage.

namespace inlineCLRsql{


public static class test{


public static void PrintMessage(){



inLineLib.Queue q = new inLineLib.Queue();

int i = q.queueId ;

Microsoft.SqlServer.Server.SqlContext.Pipe.Send(i.ToString());



}

}

}

to access this from the db, I attempted to create an assembley referencing inLineCLRsql.dll. This didn't work as it complained about inLineLib assembly not existing in the db. I then attempted to create an assembley for  inLineLib but it barfed saying  System.Management assembly not created.

so what I did is (and this is where I need to know if I just ruined sql server or not):

1- ALTER DATABASE myDB SET TRUSTWORTHY ON;.

2- CREATE ASSEMBLY SystemManagement

FROM 'C:WINDOWSMicrosoft.NETFrameworkv2.0.50727System.Management.dll'

WITH PERMISSION_SET = UNSAFE

3- CREATE ASSEMBLY inLineLibMaster

FROM 'D:inLineServerinLineLibinDebuginLineLib.dll'

WITH PERMISSION_SET = unsafe

4- and finally

CREATE ASSEMBLY inLineLib

FROM 'D:inLineServerCLRSQLinlineCLRsqlinDebuginlineCLRsql.dll'

WITH PERMISSION_SET = SAFE

 

Everything works after those steps (which took some trial and error). I can create a sproc like:

CREATE PROC sp_test AS

EXTERNAL NAME inLineLib.[inlineCLRsql.test].PrintMessage

and it returns the Queue ID

Is there anything unadvisable about the steps above?

 

Thanks for your help

 

M

 

 

View Replies !
How To Prevent System Administrator To View And Edit A Database Structure And Data
I represent a software development house and we have developed a client server system based on SQL Server. Most of our customers have already purchased Enterprise License of SQL Server, therefore they own the SA Login and Password. We are bound to attach our Database with their Server on their machine.

My question is how can we stop a System Administrator of SQL Server to view our Database Structure, Queries, Data installed on their SQL Server on their machine.

Our database structure is a trade secret and we cant reveal the structure to the client.

please answer this question by email to me at farhandotcom@gmail.com

Thanks & Regards
Farhan

View Replies !
Error Registering Assembly Using CREATE ASSEMBLY
We have written a test CRL stored procedure to test replacing one of our complex stored procedures but can€™t get it deployed to our SQL server that hosts a mirrored configuration of our production database (very locked down). It works fine on our development instances (not very locked down). It only references the default assemblies that were added when we created the project. All it does is use Context Connection=true to get data, loops though some records and returns the data using SQLContext. CLR is enabled on SQL server, the assembly is strongly signed, and we tried deploy using the binary string with the SAFE setting.
 

 CREATE ASSEMBLY for assembly 'SQLCLRTest2' failed because assembly 'SQLCLRTest2' failed verification. Check if the referenced assemblies are up-to-date and trusted (for external_access or unsafe) to execute in the database. CLR Verifier error messages if any will follow this message
[ : SQLCLRTest2.StoredProcedures::GetLift][mdToken=0x600001e] Type load failed.
[token  0x02000008] Type load failed.
 

View Replies !
Northwind Database In SQL Server Express Is Busted And Gone,after SqlCommand Fails In VB2005Express-How To Prevent It Happen?
Hi all,
 
I tried to use dbo.tables of Northwind database in SQL Server Express to do SqlCommand to populate a DataTable in DataSet. The SqlCommand failed in the project execution and I found that Northwind database in SQL Server Express is busted and gone (just the name "Northwind" remained in the SQL Server Management Studio Express).  How can I prevent it from happening in my "SqlCommand-SqlConnection" project? Please help and advise.
 
I tried to repair my "Northwind" database by using the SQL2000SampleDb.msi of Northwind and pubs Sample Databases for SQL Server 2000 downloaded from the http://www.microsoft.com/downloads.  My "pubs" database is still in my SQL Server Management Studio Express.  How can I just repair my "Northwind" database by using the Microsoft SQL2000SampleDb.msi program?  Please help and advise this matter too.
 
Thanks in advance,
Scott Chang  

View Replies !
Possible To Encrypt Database Assembly?
Hello.

I've built a simple Visual Basic .NET project containing the following code...

Imports System
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.SqlTypes
Imports Microsoft.SqlServer.Server

Partial Public Class StoredProcedures
    <Microsoft.SqlServer.Server.SqlProcedure()> _
    Public Shared Sub WhoAmI()
        Using connection As New SqlConnection("context connection=true")
            connection.Open()
            Dim command As New SqlCommand("SELECT SUSER_SNAME()", connection)
            SqlContext.Pipe.ExecuteAndSend(command)
        End Using
    End Sub
End Class

From Visual Studio, I want to encrypt the contents of this assembly, as a proof-of-concept.
Even though assembly contents are stored as varbinary(MAX) in the database, converting to varchar(MAX) will expose the code.

However, the Dotfuscator Community Edition reports the following error: "Dotfuscator Community Edition cannot operate on SQL Server applications.... please try Standard or Professional Edition."

Has anyone tried encrypting a database assembly and deploying to the database?

A good test would be to issue the following TSQL script against the database holding the assembly...

-- Does the sample code above run?
EXEC dbo.WhoAmI
GO
-- Is the code readable?
SELECT * , Convert(varchar(MAX), content) FROM sys.assembly_files

View Replies !
Database Creation
Hi,
I am not sure is this a proper place for my question.
All we know that creating a database can be done as the following.
1) Create a project named DBExample
2) Click Add->New Item.
3) Select SQL Databse and type a name.(Ex:  Database1.mdf) A database is added to the project
4) Then add table and input values.
5) Set the primary key....
My question is I parsed a text file to form a 2d string array x. How can I convert x into the database?
 
Thanks

View Replies !
Database Creation
Hello...
I want to develop a web site having two features
1. Online Shopping2. Forums
Im using SQL Server, ASP.NET and C#. Now the problem is that how do I configure the Databases. Whether I create new database for each or I marge the both things into one database. if i create saperate databases for each of the feature then users have to register for two times, first for forums and second for shopping. I dont want to do this...! I want users to register just for once.
____________Thanks in advNauman Ahmed

View Replies !
Database Creation
I downloaded the sample database AdventureWorks  from microsoft . When I run the download it created the data and log files under data folder in MSQLalong with other data and log files of master databases etc. However I do not see this database in SQLserver management studio. Can some one help me how to fix this so that I will be able to see this database in management studio.

I am downloading this for SQL server reporting purpose

View Replies !
Database Creation
hi

if i open the management studio express and trying to create a database by right clicking the server name and trying in the new query window,im getting error as

CREATE DATABASE permission denied in database 'master'.

can anyone help me in rectifying this error?

Thanks in advance

 

 

View Replies !
Database Creation With SMO In SSE
Hi there. 

I tried finding any info regarding this approach and I can't find any, so here I am (again!). 

I'm trying to create a database using SMO on a freshly installed SQL Server Express (not going through the advanced install, not going through the surface area configuration, so a lot of things are "wrong"). 

I get an error

- use SMO to try and create a database; this is the pseudo-code combo used:

1. create new Smo.Database object;

2. create new primary file group and data file for that database (using Smo.FileGroup and Smo.DataFile); add them to the database. 

3. invoke Create().  catch exception with the following details:

Exception details:

Microsoft.SqlServer.Management.Smo.FailedOperationException was caught
  HelpLink="http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.2047.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+Database&LinkId=20476"
  Message="Create failed for Database 'NewDatabase'. "
  Source="Microsoft.SqlServer.Smo"
  Operation="Create"
  StackTrace:
       at Microsoft.SqlServer.Management.Smo.SqlSmoObject.CreateImpl()
       at Microsoft.SqlServer.Management.Smo.Database.Create()
       at Penta.Core.Library.Sql.Classes.Penta_SqlDatabase.Create() in C:Documents and Settings[...]


InnerException:

{"Directory lookup for the file "C:\Documents and Settings\[...]\NewDatabase.mdf" failed
with the operating system error 5(Access is denied.).
CREATE DATABASE failed. Some file names listed could not be created. Check related
errors."}


Seems like user rights error. 

Long story short, the only way the creation step works is if I change the Log on for the SQL Express service from the default Network Service to Local System (either through code or not). 

Now, I know LocalSystem is not a wise idea, but it seems to be the only way. 

I know it's probably something stupid, but what am I missing? 

Thanks you in advance

View Replies !
Error 6522 Trying To Run Assembly From Database
Hi,

I am attempting to load an assembly that has been stored in a table as a byte array. I have created a c# class called AssemblyLoader that takes in 2 parameters, the assembly name and the parameters for the assembly (just a query string).

From this it returns the assembly byte array using a simple sql statement within the class using the assembly name to select the assembly bytes to return from the database.

The returned byte array of the assembly is loaded using: 

    Assembly assembly = Assembly.Load(assemblyBytes);


This seems to be the line that SQL Server 2005 is erroring on. Do I need to add some extra assemblies to the database and if so which ones.

Error:
Msg 6522, Level 16, State 1, Procedure ClientInterface, Line 0
A .NET Framework error occurred during execution of user defined routine or aggregate 'ClientInterface':
System.IO.FileLoadException: LoadFrom(), LoadFile(), Load(byte[]) and LoadModule() have been disabled by the host.
System.IO.FileLoadException:
   at System.Reflection.Assembly.nLoadImage(Byte[] rawAssembly, Byte[] rawSymbolStore, Evidence evidence, StackCrawlMark& stackMark, Boolean fIntrospection)
   at System.Reflection.Assembly.Load(Byte[] rawAssembly)
   at Reflector.runQuery(String query, String parameter)

Thanks for your help.

View Replies !
Dynamic Database Creation
Hi All,
I have a web site where the user can select from a list of databases (they're actually all the same structure, but have data unique to each client). Each database is a SQL 2005 database held in the App_Data folder. This all works a treat. Each database is simply named after the client it is holding data for, and the connection string for each is stored in a database that is accessed
However, what I need is a form where  a database name can be entered, and I can then create a new database with the same structure as the others - including tables, indexes and stored-procedures. I know I can use the copy database wizard in the Management Studio, but that isn't an option to the users of this system (it's to be used on an intranet, and the page I'm trying to create will only be used by project managers - but these people won't have a clue when it comes to configuring databases themselves). I have scripted a database, but have no idea on how I can actually use this script from within Visual Studio and more importantly, don't know how to configue it to have the database name as a parameter.
I've also seen some examples that suggest using SQL-DMO, but haven't been able to work out how to use it and according to Microsoft it shouldn't be used for new developments (http://msdn2.microsoft.com/en-us/library/ms132924.aspx).
Anyway, I really hope someone is able to offer some assistance on this one as I've spent a whole day trawling forums and various web-sites trying to find a solution to this.
Thanks & regards,
Paul

View Replies !
Creation Scripts From A Database
I would like to know the sql command to generate all the scripts of a database so that I can replicate the same database for testing purpose. For instance, I need those scripts to help me re-create the database itself and indexes, triggers, and stored procedures of it if possible.
I remember there was a command to display all these scripts in Sql but I forgot it. If someone knows it, please help. Thanks in advance.
blumonde

View Replies !
Sql Statement For Database Creation
I have a .sql file that works from command line for creating an sql database. I was wondering if anyone knows of a way to use this file as part of larger asp.net application to remotely create a database on a slightly modified version of the .sql file.

-Can I include all the commands in a single SqlCommand?

-Can I make copy a .bat file to server on initial app installation and then run it from asp.net page (I would think this would be security problem)?

-Is there any way other than those listed above to run a .sql file?

I included the .sql file contents below in case some of the commands require special handling.

Thanks in advance,

-Sam


-- ==========================================
-- Create Database
-- ==========================================

CREATE DATABASE testdb
ON (
NAME = testdb_data,
FILENAME = 'c: estdb estdb.mdf',
SIZE = 50,
MAXSIZE = 100,
FILEGROWTH = 10
)
LOG ON
(
NAME = testdb_log,
FILENAME = 'c: estdb estdb.ldf',
SIZE = 10,
MAXSIZE = 20,
FILEGROWTH = 5
)
GO

-- ==========================================
-- Create Tables
-- ==========================================

USE testdb
GO
CREATE TABLE dbo.docs
(
DocID INT IDENTITY NOT NULL,
lastname VARCHAR(20) NOT NULL,
firstname VARCHAR(20) NOT NULL,
ssn VARCHAR(9) NOT NULL
)
GO

-- ==========================================
-- Create Indexes
-- ==========================================

USE testdb
GO
CREATE INDEX empname ON dbo.docs
(
lastname,
firstname
)
GO

-- ==========================================
-- Create Stored Procedures
-- ==========================================

USE testdb
GO
CREATE PROCEDURE im_searchdocs
(
@lastname VARCHAR(20),
@firstname VARCHAR(20),
@ssn VARCHAR(9)
)
AS
SELECT * FROM dbo.docs
WHERE lastname=@lastname AND firstname=@firstname AND ssn=@ssn
GROUP BY lastname, firstname, ssn, docid;
GO

-- ==========================================
-- Add System Values
-- ==========================================

INSERT INTO dbo.docs (lastname, firstname, ssn) VALUES ('smith', 'john', '123456789');

View Replies !
[help] Scripted Database Creation
Hi all :)My apologies if I posted in the wrong groups, but I just jumpedin MS SQL waters, so any guidance will be appreciated.What I'm trying to do is the following process:[1] present operator with a web page (script)[2] once filled with db name and username, script will create..sql file[3] osql.exe will be called with, i presume, -i file.sql andcreate a databaseI have limited SQL knowledge, but I got the information fromEnterprise Manager when I ran 'All Tasks -Generate SQLScript' on how the .sql file should look like.I realized what are the commands that would create a fresh DB(I ran this for newly created DB), and figured my .php scriptshould create such a file.It's fairly basic, and I'm almost sure all of you know howoutputed .sql file looks like, but anyway here it is:Script is called with parameters 'six' as database name and'magarac' as user name:---------------------------------------------------------------IF EXISTS (SELECT name FROM master.dbo.sysdatabases WHERE name= N'six')DROP DATABASE [six]GOCREATE DATABASE [six] ON (NAME = N'six_Data', FILENAME = N'E:Databasepathsix_Data.MDF' , SIZE = 1, MAXSIZE = 20,FILEGROWTH = 10%) LOG ON (NAME = N'six_Log', FILENAME = N'E:Databasepathsix_Log.LDF' , SIZE = 1, MAXSIZE = 20, FILEGROWTH= 10%)COLLATE SQL_Latin1_General_CP1_CI_ASGOexec sp_dboption N'six', N'autoclose', N'false'GO....use [six]GOif not exists (select * from dbo.sysusers where name =N'guest' and hasdbaccess = 1)EXEC sp_grantdbaccess N'guest'GOif not exists (select * from dbo.sysusers where name =N'sinisam')EXEC sp_grantdbaccess N'magarac', N'magarac'GOexec sp_addrolemember N'db_owner', N'magarac'GO---------------------------------------------------------------I managed to get an exact replica of .sql file that EnterpriseManager created. It leads me to believe that this way ofautomated database creation is indeed possible.Really sorry for making you to go through all this text, butafter I get a green light on this from you guys, I'll have abit more problematic question.Is there any reason why this should not be used, or would fail?Thanks in advance :)P.S.Just as a heads-up, next part of my problem is automatedcreation of new MS SQL server login to use with new DB.

View Replies !
Creation Of Reporting Database
We have a production database, but due to the crippling load of somereporting tools, we are looking to have a separate reporting database.Due to it's nature, the reporting database doesn't need to be as upto date as the master, perhaps it could be refreshed every evening?What I wish to know is the best way to go about this. Replicating awhole database seems excessive as there are 7000+ tables and we don'tneed it so closely matching the production database. Log shippingalso seems out as we need the reporting database to be highlyavailable and if we keep applying transaction logs ever 15 minutes orso, we need to kick all the users out.Is there a way of scripting or automatically getting SQL Server 2k tocopy over the last full backup it did and apply this to anotherserver? Also if we used this method, what would happen to the usersstored in the database? Would I have to keep re-adding them after theupgrade?Is there a better way to tackle this problem? All help gratefullyreceived. We are running SQL Server 2000 Enterprise Edition on aWindows 2000 Server machine.Thanks.

View Replies !
Creation Of Database From Dump
Hello,

I have a SQL database dump with me. I would like to create a database using the dump. Could somebody help me with the steps?

Thanks :)

View Replies !
Dynamic Creation Of Database
I would like to create a stored procedure that can be called from the master database to create a new database.

I can successfully create a database with out using variables for the database name and the device names. As soon as I change them to variables I get errors all over the place. Can this be done in SQL 7.0 or is this something that can not be done?

If someone would have a sample I would appriciate it.



Thanks

Tom

View Replies !
Database Schema Creation
Although this isn't really an ASP question it is pretty advanced. Well at least in my opinion it is.

I am creating an articles page. Where someone will write articles online via a form and put the articles into a database.

Here is simplified database schema for the articles.

Name of Table: ArticleInfo
field Name: articledate - datetime
field Name: articlenumber - auto-incremented field
field Name: articletitle - varchar
field Name: articlemessage - text

I am developing this using SQL Server as a backend. What my question is about creating the auto-increment field.

I want to have two primary keys together that will identify a single row, namely articledate and articlenumber.
ArticleNumber is basically the count of that article for that date.

For example a sample database would look like this:
no articletext and articletitle's displayed here but just the other two columns:

articledate articlenumber

1/1/2000 1
1/1/2000 2
1/2/2000 1
1/3/2000 1
1/4/2000 1
1/4/2000 2
1/4/2000 3

As you can see I want the articlenumber field to start over auto-incrementing with each new unique articledate inserted into the table. I hope you understand what I am trying to do.

How do I create this schema in SQL Server? Using triggers?
I have thought about trying to write a stored procedure with the following code

-check if that date exists already in the record
-then use the identity function which allows you to specify a beginning increment value if the date does not exist

but I would need to lock the table so that concurrent articles wouldn't mess up the articlenumber. what i mean is if no articles existed for that date and I have two seperate authors entering information for that date then it is possible the stored procedure might give both articles the articlenumber of 1 since none existed before and they are simutaenously entering data.

is there a better way to do this? i hope you understand my database schema and my problem!

View Replies !
Auomate Creation Of Database
Hi!All
I need to automate creation of database by passing name of database .Is it possible to this?If yes How to do ?

Thanks in advance for your your co operation.
Pradip

View Replies !
Database Creation Using VB.NET Code
Hello.

I think its silly question but i expect some solution .

Is there any way to create sql sever database by using VB.NET code ? I have to create database,tables,sps and also transfer the data from one database to newly created database.

Please, if somebody have some solution then guide me in detail.

Thanks in adv.

View Replies !
Database Script Creation
In the paste I have used SQL2000 to create db from the Query Analyser.  In SQL2005 I can't see Query Analzyer but found under programs --> Microsoft SQL Server 2005 --> Configuration Tools --> Reporting Services Configuration --> Database Setup.  It creates a database and I can connect to it from VS.NET.  Here is my dilema,  I was provided SQL scripts to create tables, stored procs etc. Where and how do I run these scripts to create these things in my newly create db. 

Also how do I remove a db in SQL2005?

View Replies !
Database Creation Problem
the following msg appears whn i try to create a new database in Microsoft Sql Server Management Studio Express.
I m on Vista Basic and using a administrator account...plz help.... i have my project whose backend is SQL 2005.

------------------------------------------------

TITLE: Microsoft SQL Server Management Studio Express
------------------------------

Create failed for Database 'timepass'. (Microsoft.SqlServer.Express.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.2047.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Create+Database&LinkId=20476

------------------------------
ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.Express.ConnectionInfo)

------------------------------

CREATE DATABASE permission denied in database 'master'. (Microsoft SQL Server, Error: 262)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1399&EvtSrc=MSSQLServer&EvtID=262&LinkId=20476

------------------------------
BUTTONS:

OK
------------------------------

View Replies !
Database Creation For Personl Starter Kit
I am unable to create the personal.mdf when I run my homepage.  I get the following error
Failed to generate a user instance of SQL Server due to a failure in
starting the process for the user instance. The connection will be
closed.
I am new at this stuff and any help will be welcomee. .
thanks
Seth

View Replies !
Default Permissions On Creation Of New Database
I notice when I create a new database within my SQL Server that the
permissions for the new database automatically adds a user (Who is configured
as sysadmin) with dbo permissions to this database.

Both within the login properties of the select user (User mapping) is listed
as Default Schema, dbo and within the permissions of the database listed as
user with connect permissions.

I have other users configured as sysadmin and they do not get this rights
(They are not expliticly listed within user mapping with dbo or permissions
as user within the database).

I've inherited this system and wonder if the user has somehow changed the
new database procedure so it changes the default permissions of new databases.

Any way to check what he's done, I can see no differences between him and
the other sysadmins but he's definatly specifically listed as a dbo on all
new databases.

Although I don't mind him having access, he's a sysadmin after all, I'd like
to make it uniform thoughout the system, i.e. using the inhertited
permissions rather than specific permissions that seem to be created when the
new database is created.

Any ideas?

Flubster

View Replies !
Database Creation From Inside Of Visual C#
When I create a database from inside of Visual C# Express, why can't I view it with the manager from the SQL Server Express Edition? I mean, it does not appear at all. Is there any problem?

View Replies !
SQL 2005 Express Database Creation
Hi guys,

i`ve just downloaded a copy of MS SQL 2005 Express. I'm relatively new to programming and DB management.

can i create a DATABASE using SQL 2005 Express itself? Or do i need other software?

View Replies !
&&"Failed To Load Expression Host Assembly. Details: StrongName Cannot Have An Empty String For The Assembly Name. &&"
I previously had an ASP.NET 1.1 site running on my IIS 6.0 server (not the default website) with Reporting Services running in a subdirectory of that website.  I recently upgraded to ASP.NET 2.0 for my website and was greeted with an error when trying to view a report.  The error was very non-descript, but when I checked the server logs, it recorded the details as "It is not possible to run two different versions of ASP.NET in the same IIS process.  Please use the IIS Administration Tool to reconfigure your server to run the application in a separate process."

 

First of all, I could not figure out where and how to do this.  Secondly, I decided to try to also change the Reporting Services folders to run ASP.NET 2.0 and when I did, I was greeted with the following message when attempting to view a report:

 

"Failed to load expression host assembly. Details: StrongName cannot have an empty string for the assembly name."

Please help.

View Replies !
Error: CREATE ASSEMBLY For Assembly
I am trying to deploy a Database Project with Visual Studio 2005 and SQL Server 2005 Standard.
I import €œSystem.IO€? and have therefore set the permission levels to EXTERNAL_ACCESS.
 
I am receiving the same error message that many folks have received.
 
CREATE ASSEMBLY for assembly 'Images' failed because assembly 'Images' is not authorized for PERMISSION_SET = EXTERNAL_ACCESS. 
The assembly is authorized when either of the following is true: the database owner (DBO) has EXTERNAL ACCESS ASSEMBLY permission and the database has the TRUSTWORTHY database property on; or the assembly is signed with a certificate or an asymmetric key that has a corresponding login with EXTERNAL ACCESS ASSEMBLY permission. If you have restored or attached this database, make sure the database owner is mapped to the correct login on this server. If not, use sp_changedbowner to fix the problem. Images.
 
My CLR access is €œon€?
 
I have tried
 
1)       From master run: GRANT EXTERNAL ACCESS ASSEMBLY to [BuiltinAdministrators].
2)       From master run: GRANT EXTERNAL ACCESS ASSEMBLY to  €œMy Windows Authentication ID€?.
3)       Run ALTER DATABASE MYDATABASE SET TRUSTWORTHY ON
4)       In Visual Studio .NET 2005 Set the permission levels to €˜external€™
5)       Tried BuiltinAdministrators and my SQL Server Windows Authenticated Login ID  for the ASSEMBLY OWNER.
 
I can compile BUT NOT DEPLOY
 
Any help would be greatly appreciated.
Regards Steve

View Replies !
CREATE ASSEMBLY Using Assembly Binary?!?!
I was trying to understand how VS.NET2005 was deploying .NET CLR assemblies to SQL2005 so I ran a trace and found some interesting results. 

VS.NET creates some SQL that looks pretty interesting:

CREATE ASSEMBLY [AssemblyNameHere]
   FROM 0x4D5A90000300000004000000FFFF000......<continue binary data>
 WITH PERMISSION_SET = EXTERNAL_ACCESS

Boy howdy!

I have tried to reproduce this and create my own deployment application but I cant figure out how they create this binary stream. The info in BOL is not much help and I have not found any samples anywhere on how to create this stream in c#.

Anyone out there been able to get this to work?

-Ben

View Replies !
Assembly MyAssembly Was Not Found In The SQL Catalog Of Database MyDB
I€™m trying to register my CLR UDF in SQL 2005 using this code   CREATE FUNCTION GetSomething() RETURNS INT AS EXTERNAL NAME MyAssembly.MyFunction.MyMethod   When I run it against my DB I get this error: Assembly MyAssembly was not found in the SQL catalog of database MyDB   I€™ve successfully registered my custom assembly in the DB (I see it under Assemblies folder), and I€™ve set CRL Enabled to 1 in my DB.   What am I doing wrong?   Thanks in advance

View Replies !
Trigger Procedure Execution On Database Creation.
Hello,

Is there a way to trigger the execution of a procedure when a database is created ? We're using this 3rd party system in which you only specify the database server. Whenever the users create a new "Storage Area", the system actually creates a new database.

I need to handle backups for that system so I want to create a procedure that will generate a backup device and backup jobs automatically whenever a database is created.

I will also need 2 procedures to handle database renaming and deletion. I searched around but can't find a way to trigger the execution of my procedures.

View Replies !
Changing Default Database Creation Location....
I have installed my modell database onto c:mssql7data...

How do I now change the properties of this so that when someone creates a database, the path it will get created to is set to d:
I thought that I could just move model, but it seems that this isn't possible.

Any advice?

thanks

derek

View Replies !
How To Find The Creation Date For A Database Diagram?
 

Hello:
 
I'd like to check the creation date of a database diagram, how to do that?
 
please advise,
Thank you

View Replies !
Distributed Database Unique Index Creation
Can anyone suggest an appropriate strategy to create unique index's when a distributed database is used. As a bit of a background I have several SQL Server 2005 servers scattered around the country and I am trying to come up with a way to create a unique index i.e. one that hasn't been used in a particular table say Staff in any of the databases around the country.
 
Performance is an issue particularly as our network isn't that fantastic has anyone done something similar and achieved reasonable speeds?
 
Thanks ...

View Replies !
Control If A SQL Database Exists Before Its Creation Or Deletion
Hi,
I'm using SQL Server 2005, and I would like to understand how to create and to drop a database without errors:
Infact, if I try to create a database that already exists, SQL Server throws the error "Impossible to create the database because it already exists", and if I try to drop a database that doesn't exist, SQL Server throws the error "Impossible to drop the database because it doesn't esist".
Before creating or dropping a database, I should control if it exists or not...
Is there a method to do that?
I found that such control for a table is the following one (in this case, I drop the table only if it exists):

if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Table1]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Table1]

I tried to adapt the statement to the database case, modifying it as follows:
if exists (select * from dbo.sysobjects where id = object_id(N'[Database1]') and OBJECTPROPERTY(id, N'IsDatabase') = 1)
drop database [Database1]

but it didn't function (it was a blind attempt).
Can you suggest me a statement to do that?
Thank you very much

View Replies !
Automate The Creation Of A Backup Job When A New Database Is Created?
I'd like to be able to create a new database and have a backup plan automatically created for it. Is there a way to do something like this?

Thanks!

View Replies !
Tools To Generating Database Creation Scripts.
Hello,
there are a tools, or a "ways" to generating "database creation scripts" from a MDF files?

Thank you for help.
Bye
Toni

View Replies !
How To Change Default Path For Database Creation
Hi,
In my system, for creating a databae the default path is in C: drive, but iwant to change into D: drive as a default path.Please tell me how to change??

View Replies !
SQLExpress Database File Auto-creation Error:
i am using sql2005, the data inserted into the database by using createuserwizrd. after that anyone give me this error
anyone ? any thought? thanks please
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. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. SQLExpress database file auto-creation error:
The connection string specifies a local Sql Server Express instance using a database location within the applications App_Data directory. The provider attempted to automatically create the application services database because the provider determined that the database does not exist. The following configuration requirements are necessary to successfully check for existence of the application services database and automatically create the application services database:

If the applications App_Data directory does not already exist, the web server account must have read and write access to the applications directory. This is necessary because the web server account will automatically create the App_Data directory if it does not already exist.
If the applications App_Data directory already exists, the web server account only requires read and write access to the applications App_Data directory. This is necessary because the web server account will attempt to verify that the Sql Server Express database already exists within the applications App_Data directory. Revoking read access on the App_Data directory from the web server account will prevent the provider from correctly determining if the Sql Server Express database already exists. This will cause an error when the provider attempts to create a duplicate of an already existing database. Write access is required because the web server accounts credentials are used when creating the new database.
Sql Server Express must be installed on the machine.
The process identity for the web server account must have a local user profile. See the readme document for details on how to create a local user profile for both machine and domain accounts.

View Replies !

Copyright © 2005-08 www.BigResource.com, All rights reserved