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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 creating indentical column

Author  Topic 

rds207
Posting Yak Master

198 Posts

Posted - 2009-11-15 : 19:25:22
hi

i 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--etc

which 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).aspx

Hope that helps.

Dattatrey Sindol
http://mytechnobook.blogspot.com/
Go to Top of Page

X002548
Not Just a Number

15586 Posts

Posted - 2009-11-16 : 10:14:36
Before I roll out the TSTL

WHAT is your problem?

The identitiy and GUID idea is nonsense

You don't need thos things for performance...but you completely lost me with the View requirement

Here's and idea

Post the DDDL of your 2 tables (including Keys, Indexes and constraints) and the DDL of your view

THAT will give us a reference point to start

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

Add yourself!
http://www.frappr.com/sqlteam



Go to Top of Page

rds207
Posting Yak Master

198 Posts

Posted - 2009-11-16 : 16:32:09
so here are my table
1.Batch_Records
colomns:
Jobname
Job_ID
BatchRecords_id(PK)
2.build_Versions(There is no primary Key ) here...
PhoneBuild
Build_id
The objective is ti link phonebuild with its jobname
Sample jobname:C6250CMMOZ30503_06AUG2009_025356pm
Sample PhoneBuild:C6250CMMOZ30503

So 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 OR
CHARINDEX(B.PHONE_BUILD + 'Blueprint', A.JOB_NAME) > 0 OR
B.PHONE_BUILD = A.JOB_NAME

so 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?

Go to Top of Page
   

- Advertisement -