473,385 Members | 1,907 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.

create index Query throug ado.net

Dil
hi all

Here am using "Use Database" keyword, as the connection string will
contain a different Initial Catalog

Pls let me know is there any Technical issues to execute this query
(Its working fine-)

Public Function GenerateCreateIndexQuery(ByVal TableName As String, _
ByVal IndexName As String, ByVal ColName As
String, _
ByVal dataBaseName As String)

Dim sqlStr As String

sqlStr = "USE " & dataBaseName & " IF EXISTS (SELECT name FROM
sysindexes WHERE name = '" & IndexName & "')"
sqlStr = sqlStr & " DROP INDEX " & TableName & "." & IndexName
sqlStr = sqlStr & " USE " & dataBaseName & " CREATE INDEX " &
IndexName & " ON "
sqlStr = sqlStr & TableName & "(" & ColName & ")"
Return sqlStr

End Function

Jan 11 '06 #1
3 2254
Dil
Hi All,

Is it the right place where I will get the answer regarding this issue
if No
Plssssss let me know ..!!

Thanks in Advance
Dil

Jan 11 '06 #2
Dil,

There are better newsgroups by instance

Microsoft.public.dotnet.framework.adonet.

However at least for me is not clear what you mean with technical issues, so
don't expect any serious answer than things as "you should use parameters".

It is very much important where you use it, on what database server you use
it, what is the impact on security on your server, etc.

To give an analogy the question is the same as a question placed in a car
magazine.

I have now a Ford as car, it is fine for me, is there any Technical issue to
drive it.

Cor
Jan 11 '06 #3
Dil
Thanks Cor ur reply

Actually am trying to execute a SQL SERVER query

for example

sqlStr=" USE pubs
IF EXISTS (SELECT name FROM sysindexes
WHERE name = 'au_id_ind')
DROP INDEX authors.au_id_ind
GO
USE pubs
CREATE INDEX au_id_ind
ON authors (au_id)"

cmd.ExecuteNonquery(sqlStr)

Its working fine :)

I want to know this method is proper or not (Is there is any
disadvantages)

Thanks once again

Dil

Jan 11 '06 #4

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

Similar topics

12
by: Tuhin Kumar | last post by:
Hi, Oracle give the error ORA-01418 when I try to do the following; Create unique index t1_pk on TABLE1(EntryId DESC) ; If the I try to add primary key Contraint using the above index t1_pk...
0
by: LaidBackWebSage | last post by:
Hi, All! I've got a very large table (149 fields -- I know, I didn't create it, and I'm working on changing it...) and I need to add an index to speed up a join query. However, when I run the...
11
by: dfurtney | last post by:
SQL Server 7/2000: We have reasonably large tables (3,000,000 rows) that we need to add some indexes for. In a test, it took over 12 hours to CREATE a new INDEX against this table. One of us...
1
by: Stephane Charette | last post by:
QUICK VERSION: How do I create an index on a field of type "MONEY"? ----------------------------- LONG VERSION: I have a table with a field of type "money". I very often need to access...
14
by: Sean C. | last post by:
Helpful folks, Most of my previous experience with DB2 was on s390 mainframe systems and the optimizer on this platform always seemed very predictable and consistent. Since moving to a WinNT/UDB...
19
by: Lyle Fairfield | last post by:
MSDN Home > MSDN Library > Win32 and COM Development Data Access Microsoft offers many data access technologies to suit various development needs. This section of the MSDN Library contains...
2
by: bobby_b_ | last post by:
I have a table where fields 1 and 2 make up the primary key. Because of this, I have a unique composite index on fields 1 and 2 (as required by DB2). Now my question is: Fields 1 and 2 are also...
8
by: GeorgeSmiley | last post by:
Does anyone know of a way, via VBA, to set the screen position of query results to a particular top, left position? I've glanced at API techniques but cannot find exactly what will do the trick....
4
by: etuncer | last post by:
Hello All, I have Access 2003, and am trying to build a database for my small company. I want to be able to create a word document based on the data entered through a form. the real question is...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.