|
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
|
|
|
|
|
Aisha Ikram wrote: 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??
Yes, 2005 uses .Net 2.0 for CLR Stored Procs and stuff like that. What your application uses has nothing to do with it
Aisha Ikram wrote: Also MSDE is not supported in Vista, does that mean applications using MSDE previously (and .NET 1.1) will not work on Vista?
No it means the MSDE won't run under Vista, your application can run on Vista and connect to the MSDE running on a different machine.
|
|
|
|
|
Thanks for the response.
originSH wrote: No it means the MSDE won't run under Vista, your application can run on Vista and connect to the MSDE running on a different machine.
Yes, I understand this but MSDE is meant to be used locally/personally. I don't understand why Vista not supporting this ? is there any way to make that work on Vista?
@!$(-)@ $@r£r@Z
|
|
|
|
|
MSDE is not supported on vista because it is free and Sql Server 2005 Express has taken over from it.
Theres no point putting more effort into MSDE when 2005 Express does everything that MSDE does and more.
Your application should work perfectly well with 2005 Express so you should be able to just do a straight swap.
(Note: well almost the only thing that might break is if you use case insensative passwords. Passwords are now case sensative in 2005)
|
|
|
|
|
thanks a lot for your response.
Any idea about my second question that why i am geeting this message:
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
------------------------------
@!$(-)@ $@r£r@Z
|
|
|
|