473,666 Members | 2,237 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Index on field length

balabaster
797 Recognized Expert Contributor
Does anyone know if it's possible to create an index based on the length of a field in a table?
Jul 7 '08 #1
4 2123
debasisdas
8,127 Recognized Expert Expert
try to create function based index.
Jul 8 '08 #2
balabaster
797 Recognized Expert Contributor
try to create function based index.
Is that possible in SQL Server? I couldn't find a way to make it work. In the end, I created some extra calculated fields and indexed those.
Jul 8 '08 #3
debasisdas
8,127 Recognized Expert Expert
Is that possible in SQL Server? I couldn't find a way to make it work. In the end, I created some extra calculated fields and indexed those.
since sql server does not suppor that type of index you need to use some workaround to create an extra field and index that . you can always populate that field using some trigger.
Jul 8 '08 #4
balabaster
797 Recognized Expert Contributor
since sql server does not suppor that type of index you need to use some workaround to create an extra field and index that . you can always populate that field using some trigger.
The fields I created are actually calculated, which I suppose in some sense work like a trigger... I may change them so they're updated by a trigger instead of being calculated which theoretically could improve query performance for selects as the calculation wouldn't need to be performed on each row as they are queried.
Jul 8 '08 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

4
2012
by: Bruce D | last post by:
I have a table, table1, with the field 'areacodeplustelephone'. This field is of length 10. I created an index called 'areacode' that only uses the first three characters. Can I use this index in my select statement? I tried this: select name from table1 where areacodeplustelephone = 330' -- no results I tried this: select name from table1 where left(areacodeplustelephone,3) = '330' -- got the results but slow...id didn't use the...
6
22414
by: Bill | last post by:
In an effort to improve the speed of queries against my main table, I'll be indexing a column whose data type is varchar(50). Would I be better off (better performance) if I changed the column's data type to some numeric type? I would have to update the column's data to accomodate this, but I would do it if this offers a performance gain. -- Bill
5
4697
by: Mike | last post by:
I'm using a script provided by e-mailanywhere, it's a little too big for me. There's 1 text field and 1 password field in a form. OnSubmit, I would like both fields to be validated to look for invalid digits (~`!#$%^&*()+=?/). This is not working yet, I don't know why. In addition, I would like both fields to require from 1 to 12 digits for submition to continue. The text field also Lowers Case, can you tell me how to do the same on...
2
2348
by: Miss Livvy | last post by:
Would it be OK to use varchar(5) instead of char(5) as the first field of a composite clustered index? My gut tells me that varchar would be a bad idea, but I am not finding much information on this topic on this when I Google it. Currently the field is Char(4), and there is a need to increase it to hold 5 characters. TIA
8
2123
by: John Baima | last post by:
I have an Access table that just consists of 2 columns: WordID (Autonumber, Primary key) and WordText (Text, Indexed, No dups). I've used this with a number of texts and languages without any problems. With my first Unicode Greek text, I've encountered a problem. The first 2 words of the text are "o(doi\ du/o". Now, those obviously are not the same words, but after I add the first, the second cannot be added because it thinks that I am...
4
3601
by: Antoine | last post by:
Herfried and Cor:- I used tracing and actually tracked down the code that was causing the problem most likely. I wonder if you wanted to comment on it. Also I wonder if there is a better way of testing if there is data than testing the length of the xml string I used as stringreader to create the dataset, but thats a side issue. I think I tried isdbnull and is nothing and stuff like that and they cause
2
1878
by: Martin v. Löwis | last post by:
I've been working on PEP 353 for some time now. Please comment, in particular if you are using 64-bit systems. Regards, Martin PEP: 353 Title: Using ssize_t as the index type Version: $Revision: 42333 $
7
2920
by: Cyberwolf | last post by:
Is there a way to set a primary index to ignore Nulls and if so how would I do it. I have already tried setting it so it is not a required field, but that does not work. It states that the field can not contain null values.
6
6232
by: john | last post by:
Last week I posted about making a unique index on multiple fields to prevent importing identical records twice. I still have trouble with the nulls in the index. The only way that I can make it work is to make all the index' fields required fields and set the allow nulls setting to false. But then every field in the index should always have some kind of value, and I have to put a default value like "0" in them or "empty". Is this indeed the...
0
8440
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8355
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8866
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
7381
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6191
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4193
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4365
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2006
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.