Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
rds207
Posting Yak Master
198 Posts |
Posted - 2009-11-15 : 19:25:22
|
| hii have created a view joining 2 tables with necessary colomns, but the data is redundant, can i create a new colomn say vlues like 1,2,3--etcwhich identically recognizes the rows...basically i want to create index to improve the performance,and i cannot find unique rows to create...i am not really sure i can create something like that...please help |
|
|
dattatreysindol
Starting Member
20 Posts |
Posted - 2009-11-16 : 05:31:33
|
| Try creating a new column say UniqueRowID and make it as an Identity column which will automatically keep incrementing as and when rows get added. Make this column as a Primary Key in the table which will automatically create a Clustered Index on this column.Refer to the following link for more details on Identity columns:http://msdn.microsoft.com/en-us/library/aa933196(SQL.80).aspxHope that helps.Dattatrey Sindolhttp://mytechnobook.blogspot.com/ |
 |
|
|
X002548
Not Just a Number
15586 Posts |
Posted - 2009-11-16 : 10:14:36
|
| Before I roll out the TSTLWHAT is your problem?The identitiy and GUID idea is nonsenseYou don't need thos things for performance...but you completely lost me with the View requirementHere's and ideaPost the DDDL of your 2 tables (including Keys, Indexes and constraints) and the DDL of your viewTHAT will give us a reference point to startBrett8-)Hint: Want your questions answered fast? Follow the direction in this linkhttp://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspxAdd yourself!http://www.frappr.com/sqlteam |
 |
|
|
rds207
Posting Yak Master
198 Posts |
Posted - 2009-11-16 : 16:32:09
|
| so here are my table 1.Batch_Recordscolomns:JobnameJob_IDBatchRecords_id(PK)2.build_Versions(There is no primary Key ) here...PhoneBuildBuild_idThe objective is ti link phonebuild with its jobnameSample jobname:C6250CMMOZ30503_06AUG2009_025356pmSample PhoneBuild:C6250CMMOZ30503So by joining these two table i want to create view ,so the syntax of my view is ..select *FROM dbo.BATCH_RECORDS AS A INNER JOIN dbo.build_VERSIONS AS B ON CHARINDEX(B.PHONE_BUILD + '_', A.JOB_NAME) > 0 ORCHARINDEX(B.PHONE_BUILD + 'Blueprint', A.JOB_NAME) > 0 OR B.PHONE_BUILD = A.JOB_NAMEso obviouly there would be duplicate records ...so i need to create an indentical colomn in first table and indentical colomn in my view to improve the performance, i thought i can create the colomn as said by user X002548 for my query ..Please let me know what it would not work? |
 |
|
|
|
|
|