Try To Use Column Info Twice In VIEW In SQL 2005

Sep 15, 2007

Hi,

I keep running into the following Error message when I try to execute the query below. Can anyone please give me an idea of how I can solve this issue and keep my data??

 CREATE VIEW [dbo].[view_mCover]
AS
SELECT dbo.tProduct.intProductId AS dblCoverId, dbo.tProduct.strProductName AS strCoverName,strProductCode AS strCoverCode, dbo.tProduct.strProdPictUrl AS strCoverThumbnailSrc,
dbo.tProduct.intSubCategoryId AS dblCoverCategoryId, dbo.tProduct.strProdPictUrl AS strCoverSrc, dbo.tProduct.floatPrice AS floatCoverCost,
dbo.tProduct.intStockQuantity AS intProductStock, dbo.tProduct.isInDesignTool as isInDesignTool
FROM dbo.tProduct INNER JOIN
dbo.tCategory ON dbo.tProduct.intCategoryId = dbo.tCategory.intCategoryId
WHERE (dbo.tCategory.intCategoryId = 6) AND (dbo.tProduct.isDeleted = 0)




 ERROR message

===============

 Error Message: Column Name 'StrProdPictURL' appears more than once in  the result column list

 

Thanks in Advance...

 DollarJunkie

View 5 Replies


ADVERTISEMENT

Reporting Services :: Two List View - Get Job Info From Table

Oct 2, 2015

I need ssrs report  which  get job info from job table in list control  and other  one is jobid and workdate which also need to be group by and storeproc I am using for this  report is as follow:

ALTER proc [dbo].[VRAJ_JobScheduleReport]            
    @JobID int = null,    @StartDate varchar(25) = null,    @EndDate varchar(25) = nullASSET
NOCOUNT ON SET ANSI_NULLS ON SET QUOTED_IDENTIFIER ON DECLARE @sql varchar(max);DECLARE @param varchar(max);DECLARE @where1 varchar(max);DECLARE
@where2 varchar(max);SET @param='';SET @where1='';SET @where2='';IF @JobID IS NOT NULL    BEGIN     
SET @param = @param + 'DECLARE @JobID int; SET @JobID=' + CAST(@JobID AS varchar(50)) + ';';      IF @where1 = ''       
[Code] ...

I need ssrs report which get job info from job table in list control and other one is jobid and workdate which also need to be group by and storeproc I am using for this report is as follow:

ALTER proc [dbo].[VRAJ_JobScheduleReport]
@JobID int = null,
@StartDate varchar(25) = null,
@EndDate varchar(25) = null
AS
SET NOCOUNT ON

[Code] .....

View 5 Replies View Related

IDENTITY Column (further Info Reqd)

Jun 14, 2002

Just a query, I have several tables that have bigint identity columns, I need to know what will happen when it reaches the upper limit. It will be most likely that earlier id fields have been deleted by the time it reaches the upper limit, so will it reuse numbers?

Cheers
Karyn

View 1 Replies View Related

Row Info Wanted In Column (like Cube)

Aug 26, 2004

Hi

I have a table called tblsample, where i have information stored row wise. Ther four quarter information is stored for many years. I want those information column wise for a given year.

say

select col1, col2 from tblsample where rqtr=1 and ryear = 2000
select col1, col2 from tblsample where rqtr=2 and ryear = 2000
select col1, col2 from tblsample where rqtr=3 and ryear = 2000
select col1, col2 from tblsample where rqtr=4 and ryear = 2000

i want information like

for the Year 2000

1 qtr 2 qtr 3 qtr 4 qtr


How to acheive this in MSSQL 2000

View 3 Replies View Related

Problems Querying Column Info

Sep 10, 2004

I am trying to print out column names and it seems i am doing something wrong. Any help??

View 2 Replies View Related

Problems Querying Column Info

Sep 10, 2004

I am trying to print out column names and it seems i am doing something wrong. Any help??

use DBI;
# use DBIx::DBSchema::Column;

#open connection to Access database
$dbh = DBI->connect('dbi:ODBC:driver=microsoft access driver
(*.mdb);dbq=C:Tempdatabase.mdb');


# retrieving field names
$cursor = $dbh->prepare("SELECT * FROM combined_structures where 1=0");
$cursor->execute;
my($fieldNames, $i);
$fieldNames = $cursor->{"NAME"};
print "Field Names = ";
for($i=0; $i < @$fieldNames; $i++)
{
print "$fieldNames->[$i], ";
}
print "";

View 3 Replies View Related

Delete/Move Certain Info From Column - Leave The Rest?

Nov 10, 2005

I have a column that contains extra info that needs to be moved to another column or deleted alltogether. is there a way to select these items and move them to another column, leaving the rest of the data in the original column?

EXAMPLE

MYTABLE >COLUMN1
May have Data Like: ABCDE123 SER1 or XYZ12DEFSer1:1

WHAT I NEED TO DO IS
Move anything after the SER1 to a new column and retain the rest of the data in the original column. making it look something like this:

COL1 COL2
ABCDE123 SER1
XYZ12DEF Ser1:1

Another question is if there is a way to delete extra spaces? Like make all data that has two or more extra spaces, just single spaces and any additional spacing after a row of data, delete all additional spaces after the last letter/character/number.

One more question - What would be a great resource to learn MS SQL in more depth?

I am trying to learn ASP/VBScript/JavaScript/ and now MS SQL all at once b/c this is what my business depends on. Trying to be 5,000 hats at once can get confusing and overwhelming, so I am looking for any "Crash course" I can to learn as much, as fast as possible. Any direction or ideas?

Thank you.

View 4 Replies View Related

Updating Column With Info - String Or Binary Data Would Be Truncated

Jan 29, 2015

I wrote this query to pull some information involving 3 tables dbo.NewFamNbrs$, dbo.CGIItemMaster and dbo.CGIFamilyMaster. In addition I want to perform an update statement to update column dbo.CGIItemMaster.FamilyIDX with the information of dbo.CGIFamilyMaster.IDX. I also know that truncation is indicating that I'm trying to insert data into a field not large enough. So I performed a len() function on the both columns and order by desc and they both came up with 4 as being the max.

Query:

SELECT a.PART, a.Family, b.FamilyIDX, c.FamilyID, c.IDX
FROM dbo.NewFamNbrs$ a LEFT OUTER JOIN dbo.CGIFamilyMaster c ON a.Family = c.FamilyID LEFT OUTER JOIN dbo.CGIItemMaster b ON a.PART = b.PART

Results of query:

PART Family FamilyIDX FamilyID IDX
000127233TF011468 TF01 506
000129880TF011468 TF01 506
003110 MET061468 MET06 1915

UPDATE STATEMENT:

begin tran
update dbo.CGIItemMaster
set FamilyIDX=c.IDX
FROM dbo.NewFamNbrs$ a LEFT OUTER JOIN
CGIFamilyMaster c ON a.Family = c.FamilyID LEFT OUTER JOIN
dbo.CGIItemMaster b ON a.PART = b.PART

View 2 Replies View Related

Transact SQL :: How To Get Info Which Stored Procedure Updated A Column For Particular Timestamp

Jul 31, 2015

How to get the details of a stored proc or sql query which updated a particular table for specified time stamp or interval. Is there any query to get this?

View 3 Replies View Related

Create Multi Column View From Single Column Data

Jan 9, 2008

I have two tables, one a data table, the other a product table. I want to perform a join on the two tables with values distributed into columns based on the value in the month field.

data_table
product_code month value
350 1 10
350 2 20
350 3 30

product_table
product_code profit_center
350 4520

result_view

product_code profit_center mon1 mon2 mon3
350 4520 10 20 30

My current query gives the following result
result_view

product_code profit_center mon1 mon2 mon3
350 4520 10 0 0
350 4520 0 20 0
350 4520 0 0 30

Any direction toward a solution would be appreciated. Am using SS2005.

View 5 Replies View Related

Updating A SQL 2005 DB With Info From FreeTextbox

Feb 14, 2006

Hi,I'm writing a very simple content management site as a first web project.The info is being entered in a FreeTextBox ID'd as FreeTextBox2.  When I use an UPDATE command to update the SQL record it inserts a NULL value into the record.  If I change the variable to simple text it inserts it properly.  For example, this inserts Test into the record:         UpdateCommand="DECLARE @FreeTextBox2 as varChar(100)         UPDATE t_content          SET PageContent = 'Test' WHERE PageID = 1">But when I run this statement it inserts a NULL:         UpdateCommand="DECLARE @FreeTextBox2 as varChar(100)
         UPDATE t_content
         SET PageContent = @FreeTextBox2 WHERE PageID = 1">Could someone please point out where I'm going wrong?  Thx :)

View 7 Replies View Related

Info About Sql Server 2005 Everywere

Jul 31, 2006

Hi ,
I must to realize a database application for an Automation system consisting of a Industrial PC with Operative System microsoft windows embedded.

1° question: Is Microsoft sql server 2005 everywere compatible for Microsoft windows embedded?
(I ask this because in specific of its is not clear)

2° question: In the case that it's compatible, if I instal it in a industrial Pc can it to act by database server or necessity of a remote server?

Tanks

View 1 Replies View Related

Is There A System Table With Timestamp Info Or DTS Job Info?

May 7, 2007

I want to be able to see when records have been added to a table. The issue is we have a DTS job scheduled to run every night. The developer who wrote it password protected it and doesn't work here anymore. I want to add a step to this series of DTS jobs and want to run it just prior to his job. Is there a way to see when the records are being added or when this job is being run? Thanks again, you guys are the best.

ddave

View 3 Replies View Related

SQL 2005 Reporting Services Security Info

Mar 29, 2007

We have 2005 Reporting Services fully functional - Dev, QA and prod (farm). I have at least 5 distinct business group trees in my structure, who have inherited or modified security based upon NT Users and AD groups. Now, we want to replace a major group (<domain_name>Domain Users) with a controlled group.

I cannot find anyway to report or map the folders that a specific NT User and AD group has rights. Cannot it be done?

View 1 Replies View Related

SQL 2005 Mixed Mode Setup And DTS Info

Mar 30, 2007

Hi there, can anyone tell me how to setup or enable mixed mode authentication in SQL 2005? also is it possible to transfer views or stored procedures from 1 database to another? If so where do I go to do this. I thought a DTS may do it but cant find the correct option in the Management Studio to do this.



Thanks in anticipation,

View 1 Replies View Related

Need SQL Server Failover Cluster 2005 Info

Apr 16, 2008



Hi all,

I need some help to known more about basics of SQL Server 2005 failover cluster . pls provide me link to
known the concept.
Thanks,
Nav

View 6 Replies View Related

Where Can I Find Info About How To Backup Sql Server 2005 Using A .bat File?

Aug 30, 2006

Where can I find info about how to backup Sql Server 2005 using a .bat file?

Is it possible doing it this way?

If so, can anyone direct me to some links how how to do this?

If not possible using a bat file... then how can I make schedueled backups? What tool to use and hopefully free.

View 2 Replies View Related

How To Get The SQL Affinity Mask Value In Sql 2005, And Table That Store This Info

Aug 29, 2006



Hi All

Can u pls tell me How to Get the SQL Affinity Mask value in Sql 2005.

and what is the table/views name that store this info.

for SQL 2000 , we were using following query:

SQLStatement.printf("select c.value from master..sysconfigures c, master..spt_values v,"
"master..syscurconfigs r where v.type = 'C' and v.number = c.config and v.number >= 0 "
"and v.number = r.config and v.name ='affinity mask'");

lErrCode=SQLExecDirect(hStmt,(SQLCHAR*)pszSQLStatement,strlen(pszSQLStatement));

lSQLBindCol(nAffMask);

But With SQL 2005 , we are getting ZERO(0) ROWS SELECTED.

View 1 Replies View Related

SQL Server 2005 Reporting Svcs - How To Use Dataset 1 Info To Drive Nested Table Select

May 20, 2008

I've only been doing sql 2005 for a couple of months with minimal training so there's a lot I don't know.
What I'm trying to do is load a nested table (industry & customer totals) based on a value from the table it's nested in.
This is the relationship of the data.
I have at the highest group, an industry code, then a customer, then the part and then the fiscal year.
What I'm trying to accomplish is to get a group total (footer) for the (1) industry code and (2) the customer code. This footer would contain the fiscal years (ascending) and their monthly totals. I would like to take the industry code from table one and pass it to the select statement in the dataset that feeds the nested table. I've read this is not possible to load a dataset field into a parm but I've seen where some people know how to work around this. If you reply, please explain in simple terms. Thanks!


industry Customer Year OCT NOV DEC
001 - Signposts
M12345
Part 1
2006 5 6 2
2007 0 3 1


Part 2
2006 4 3 0
2007 1 0 7

Customer M12345 totals
2006 9 9 2
2007 1 3 8


M45678
Part 3
2007 8 4 7
2008 3 4 8


Part 4
2006 3 8 7
2007 5 6 6


Customer M45678 totals
2006 3 8 7
2007 13 10 13
2008 3 4 8
Industry 001 totals




2006 12 17 9
2007 14 13 21
2008 3 4 8

View 1 Replies View Related

How To Add An Identity PK Column To A View

Nov 16, 2007

For an ASP.net project, I have had a DropDownList with a static ArrayList.The ArrayList will be defined from a View, where there is no Identity PK. 
I also have used cbxDropDownListName.SelectedIndex to add new data toa table, where an Indetity PK is used to reference the ArrayList. 
 I am wondering how can I add an identity PK to my view?
TIA,Jeffrey

View 1 Replies View Related

Compute Column In View...

Mar 11, 2006

I have a SQL table that consists of columns A, B and C.  I am trying to construct a view consisting of all columns (i.e. A, B, C) and a computed column.  This computed column has the following logic:
If B is blank or null then  NewColumn = A + ' - ' C
else
 NewColumn = A + ' - ' + B
I am just wondering how the SQL statement should look like....
 

View 2 Replies View Related

View Changes Data In A Column

Sep 17, 2001

Is there a way of changing the value of a column in a view? For example, I have a table with defect code and a description (other columns as well). In a view, I would like to see only the defect code and the description, but if the code is > 90, I would like to define what the description is.

TIA
Jennifer

View 2 Replies View Related

Computed Column Of A View

Jun 11, 2003

I have a view that has 2 columns. The first column is associated with a function for the Units. The second column calculates the Market Value:

View
====
Col1: Unit = get_number_of_units()
Col2: MV = get_number_of_units() * get_unit_value()

I need to call get_number_of_units() twice in the view. Is it possible to changes Col2 to something like: MV = Col1 * get_unit_value()?

Is get_unit_value() being called if I do Select Col1 from View?

Thanks.

View 1 Replies View Related

MS SQL View The Column Entries

Oct 25, 2006

I have just started learning PHP and MS SQL. I was having a problem viewing the database (column entries) in the MS SQL server managemnet studio. I can see the column names but I cannot see the entries that I save in it.
Ne help pls !!!
Any yes the data is saved because when I use the "select" command I can print the data.

View 2 Replies View Related

How To Add A Calculated Column In A View

Apr 21, 2008

*first issue
how to add a calculated column in a view such that this calculated column will be calculated from the oraginal columns

create view vw1
as
select tab.col1,tab.col2 from
from tab

and i want to add a column that contains the result of a comparison between col1 and col2 (col1<col2) such that the values of the column will be true,false

thanx

View 2 Replies View Related

Creating A View With A New Column

Jan 31, 2014

I'm using SQL Server 2008 to solve the following exercise.

I have three Tables:
Table CUSTOMER with columns: CustomerID,Company,ContactName,Phone
Table ORDER with columns: OrderID,OrderDate,ShippedDate,ShipperID,Freight,CustomerID
Table Shipper with columns:ShipperID,Company,Phone

I need to Create a view listing the shipper and the number of unshipped orders. I have been trying to use joins or possibly subqueries, but I'm not getting a correct result for a ShipperID with NO unshipped orders.My view should looks like: ShipperID, Company, Phone, UnshippedOrders

View 4 Replies View Related

Can Reference A Column In A View

Aug 14, 2014

how can i reference a column in a view.

My duplicate check runs against the entire column. There might be another test field that has the same value, and that might be valid, so im trying to make sure that when i do the check, i am checking only against the serial number field and not all test fields.

View 2 Replies View Related

Temp Column In VIEW

Sep 27, 2005

Not sure if I am approaching this correctly. I can get name, address, zip code from a table via a VIEW. But the problem is I need to create another column called "status" in the same view that is based on "customer_end_date" if end_date> GETDATE() then 'P'(pick-up) and end_date< GETDATE () then 'I'(install). Using a stored procedure this is easy...but how would I do this in a VIEW?

View 6 Replies View Related

Add Column To A View - RESOLVED

May 3, 2006

I am creating a view in SQL using the View tab in the database and adding the table and the fields I need. For criteria I need to have 28 'or' s . How do I insert more columns on the end of my view ?

View 2 Replies View Related

Update Column In A View

May 21, 2006

Hello all,
I'd like to create a view which shows all specific column values
(null values for example)
as calculated values from another column,
if for example i have the table:
---------------
| col1 | col2 |
|------|------|
| 123 | null |
| 126 | 9 |
---------------
i would like the view to be:

---------------
| col1 | col2 |
|------|------|
| 123 | 6 | ----> 6, since it's the sum of col1 digits 1+2+3
| 126 | 9 |
---------------

I don't really know how to do that, although i'm quite sure it's possible, any help will be appreciated,

Best Regards,
pitt

View 3 Replies View Related

Finding Column Name Associated With View

Apr 30, 2007

I want to find columns name associated with view. For example; can you please help me to write query? I need to write for several tables.

TableName Column View
---------- -------- -------
Employee EmpId v_EmployeeDetails
Employee Firstname v_EmployeeDetails
Employee Lastname --
Employee SSN v_PersonalD
Employee DOB --

___________________________________________________
--just example

go
create view v_EmployeeDetails
as
select EmpId,Firstname from Employee

go

go
create view v_PersonalD
as
select SSN from Employee

View 5 Replies View Related

Bcp Into View With Derived Column

Jan 10, 2006

Hi,I have a view that looks something like this -CREATE VIEW myview AS SELECTmyudf(col1) as col1, col2, col3FROM mytableThe view has an 'INSTEAD OF' trigger on it to do the correct thing oninsert. When I run the bcp, it runs successfully, but the valueinserted into col1 is always NULL. I modified my trigger to get abetter idea of what was happening, and when I look at the values ofINSERTED.col1, they are all null. It appears that bcp is setting thecolumn value to null, presumable because the view definintion for thiscolumn is a derived column.Does any one know a way around this?Thanks!

View 5 Replies View Related

Change A Column Name In A View

Apr 24, 2008



Hello,
I am going to change a column name YYZ in a VIEW because of typo. It should be named as YYY.
What is best scenario?

Thanks

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved