|
how one can apply unique constraint using MS SQL Server Management Studio.
I can see in table property "Replicated" but i can't change its values as its disabled. Or I've to user general query like the one below;
CREATE TABLE Customer(SID integer UNIQUE);
|
|
|
|
|
Does anyone know a fast way of getting the primary key column of a table using SQL SMO? My aproach so far has been to run through all of the columns checking to see if they are primary key columns...
Apparently it's not OK to start a bonfire of Microsoft products in the aisles of CompUSA even though the Linuxrulz web site says so
|
|
|
|
|
|
tbl.Indexes(0).Name seems to give me the constraint name...but i need to column name, sorry if i missed it, but i didnt see it in your code.
Thanks for the quick response
Apparently it's not OK to start a bonfire of Microsoft products in the aisles of CompUSA even though the Linuxrulz web site says so
|
|
|
|
|
As far as I can remember you'd have to loop and check.
Is the problem that doign the loop and check is very slow?
If so check out the 'SetDefaultInitFields' method.
|
|
|
|
|
The fastest way i have found so far is by extending your idea slightly:
<br />
If tbl.Indexes.Count > 0 Then<br />
If tbl.Indexes(0).IndexedColumns.Count > 0 Then<br />
Return tbl.Indexes(0).IndexedColumns(0).Name<br />
End If<br />
End If<br />
Apparently it's not OK to start a bonfire of Microsoft products in the aisles of CompUSA even though the Linuxrulz web site says so
|
|
|
|
|
Hi,
its possible to generate some event from database? Let say that i have in some table cell with date and time with value 23-06-2007 13:14:05 and when time will be equal to this value database will do some thing like: remove this record and increment some value in other table...
Its possible to do?
Any idea how resolve it?
Greetings
|
|
|
|
|
I think your looking to implement Trigers[^]
|
|
|
|
|
Hi,
no... im not looking for trigers... trigers are launched when someone do insert update etc... not when some valu eis equal to other value...
Greetings
|
|
|
|
|
How does one value becomes equal to another without some update operation?Anyways you seem to know what you want...
|
|
|
|
|
It should works like:
Table structure
id - int
time - datetime
action - varchar
Current operation time: 30-06-2007 11:40:01
insert new row with value
time="30-06-2007 13:33:11"
action="delete"
nothing happen cause now is 30-06-2007 11:40:01
time spend... and is 30-06-2007 13:33:11
Sql server do some action like deleting row and insert or increment data in another one table...
Sorry for my english
Greetings
|
|
|
|
|
I found that in MySQL is something like: create event
Is in MsSQL2005 something simmilar?
Greetings
|
|
|
|
|
You're talking about a trigger, all right.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Can you give me a sample how to do this using trigers?
Gretings
|
|
|
|
|
The SQL Server books online have lots of trigger examples, a trigger is code that runs when a table is updated or inserted, in that code, you can examine the values that were changed or added, and modify your actions according to those values.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
|
I would seem that what you actually want to do is use the database to control a schedule: by setting the start date and time in some field in a table you want to be notified when that entry equals the current system time.
I don't know of any way to do this purely in the database without any external program help. You would need to poll the database and do the comparison yourself programmatically...
|
|
|
|
|
i want to create a trigger.in that trigger when modifying a value from a categorytable i want to check whether any another table in the database containing category id with that value .if it is there i want to display one message.How can i do that?.............
|
|
|
|
|
You can query sysobjects for tables in your database and syscolumns for their respective columns (based on ID).Run these queries on your database
<br />
select * from sysobjects<br />
select * from syscolumns<br />
|
|
|
|
|
YESTERDAY I POSTED SOME QUERIES I NEED THEM NOW BUT THEY HAVE BEEN MOVED
WOTS THE REASON?
I NEEDED ALTERNATIVES FOR THOSE QUERIES
|
|
|
|
|
maybe its your altitude...
|
|
|
|
|
You posted the same question 6 times in a day. They got marked as spam, probably because you kept asking them over and over.
If you follow the forum rules, and abide by simple netiquette, your posts won't be marked down.
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
hello,
iam working on an application which has a database, i wanna deploy my project and create an installer to it but i have a problem with the database, how can i install database with my project,
and if i create a demo version of the project how can i make the application work without installing MS SQL Server, can i do that???
in other words should MS SQL Server 2000 be installed on the machine to make the application running ? or can i embbed my database with the application in some way.
thanks and iam waiting ur replies
its urgent plzzzzzzzzzz
|
|
|
|
|
You can use SQL Server Express, if you want to distribute something that is free. Or move to Access.
Mdallal84 wrote: in other words should MS SQL Server 2000 be installed on the machine to make the application running ?
Yes, and once it's installed, you need to run scripts to create the database on the SQL Server instance, and make sure it's installed correctly in relation to your connection string ( it could be a named instance, for example )
Christian Graus - Microsoft MVP - C++
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Would an application developed in .NET Framework 1.1 and using MSDE be able to work with SQL Server 2005 Express edition which uses .NET 2.0?? Also MSDE is not supported in Vista, does that mean applications using MSDE previously (and .NET 1.1) will not work on Vista?
Also i have restored a DB with some existing users in SQL Express .Now i select Security>Users and try to delete the existing user but it gives me a strange exception like:
TITLE: Microsoft SQL Server Management Studio
------------------------------
Drop failed for User 'test_user'. (Microsoft.SqlServer.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.1399.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Drop+User&LinkId=20476
------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
The database principal owns a schema in the database, and cannot be dropped. (Microsoft SQL Server, Error: 15138)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.1399&EvtSrc=MSSQLServer&EvtID=15138&LinkId=20476
------------------------------
Any idea?
@!$(-)@ $@r£r@Z
|
|
|
|