Use A Column In 2 Ways

Aug 9, 2013

I have to made a change and want to see it this is possible. The column IDPRT# is used here as MAX. THe user wants to exclude a few of the items which skews the average. Can i also select the IDPRT# a second time? and then in the CRystal reports I can select not =? but will this mess up the MAX line in any way?

SELECT "OEIND94"."IDDOCD" AS INV_DATE,
"OEIND94"."IDORD#" AS ORD_NUM,
"OEIND94"."IDORDT" AS ORD_TYPE,
"OEIND94"."IDPRLC" AS PROD_FAMILY,
"OEIND94"."IDPR$C" AS PRICE_CODE,
"OEIND94"."IDCOM#",
MAX("OEIND94"."IDPRT#") AS ITEM_REF,
"ICPRT1"."IARCC4" AS PROD_TYPE,

[code]....

View 2 Replies


ADVERTISEMENT

Please Help Me I Try All The Ways

Jan 4, 2008

Source Error:



An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.
 this is the source error for this error
An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
please any one can help me?

View 1 Replies View Related

DTS Or Some Other Ways

Sep 7, 2000

I want move data from informix to SQL server 7.0 every 10 seconds. I do not know what is the best way. It seems that I need create a DTS package and schdule the task from SQL server Agent, but can the task be schduled to reoccurred every 10 seconds?

Thanks in advanced.
Yu

View 4 Replies View Related

Ways To Optimize The SP

Jun 24, 2008

Hello,

Can any one suggest me in optimizing the SP.
To execute single SP it takes nearly 50 seconds.
Can i know what are ways to optimize the SP.

Thanks
Ganesh

Solutions are easy. Understanding the problem, now, that's the hard part

View 4 Replies View Related

Different Ways To Set DATEFIRST

Oct 28, 2007

Hi All,

My week starts on Monday rather than on Sunday which is default(US, English) in SQL Server and would like to change the same so I would get proper weeknumber and dayindex using DATEPART.

I am looking at different ways of setting DATEFIRST(SET DATEFIRST 1) in SQL Server 2005.

I could set in a stored procedure, but this isn't a feasible way for me because I am using .nettiers to generate by business objects and stored procedures. I need to alter the sp's everytime I newly generate the code and sp's.

I couldn't set it in a function which I was hoping initially. I understand this datefirst is stored in one of the sys table in MASTER DB and I couldn't find a straight forward way to change this.

Can anyone suggest me a way to set the DATEFIRST either at a database level or at a server level(probably by changing the sys table in MASTER DB).

Any help on this would be greatly appreciated.

Ponnu
Trellisys.net

View 5 Replies View Related

How Many Ways To Connect To A Database?

Aug 12, 2007

How many ways are there to connect to a database in ASP.NET? Could someone list them in a 1,2,3... manner.
 For those who are going to ask why I want to know this and why I don't do one way, I'll explain after I get the answer.

View 4 Replies View Related

Query To Display Sum In Different Ways

May 24, 2014

I have I rather complex query and need to display a Sum in different ways. Now I'm wondering if the performance improves if you nest the queries in the described way. To me it looks, as if the sum just has to be calculated once?

select SUM(tiempo) as time_minutes,
CONVERT(varchar(5), dateadd (minute,sum(tiempo),'1900-1-1 0:00'), 114) as time_hours,
SUM(time)* 0.95 as time_discount
from table

Select tiempo as time_minutes,
CONVERT(varchar(5), dateadd (minute,tiempo,'1900-1-1 0:00'), 114) as time_hours,
tiempo * 0.95 as time_discount
From (
Select Sum(tiempo) as tiempo
from table)a

View 2 Replies View Related

Different Ways To Get The Current Datetime,

May 2, 2008

What is the difference between these 3 functions:
getdate()
{fn now()}
current_timestamp()

View 4 Replies View Related

Help - Conditional Checks Within A SQL Query - Other Ways Of Doing It?

Jun 13, 2007

I'm trying to simplify a SQL Stored Procedure.The query accepts an int, @ItemTypeID intI have the Query:SELECT ... FROM ItemList WHERE ItemTypeID = @ItemTypeIDor, if @ItemTypeID is 0,SELECT ... FROM ItemList Is there a way to do this query without doing:IF @ItemTypeID = 0BEGIN   ...SELECT QUERY...ENDELSEBEGIN   ...SELECT QUERY...END? 

View 5 Replies View Related

(sql 7.0) Linked Servers -- Any Issues Or Other Ways Around It?

Jun 7, 2001

Hey - I am trying to create a procedure that will retrieve information from multiple SQL Servers. For example, I want to use a select statement on a systems table. Instead of running it from each server, I would rather run it from one and get info on all the servers. To do this, I know that i can 'link' a Server and then make select calls to that server. Some of the other administrators have expressed concern with this. Are there issues that I should research before linking servers. Is there a better way to do what I want to do? Any Input would be appreciated.

View 2 Replies View Related

Ways To Determine Intermittent Slowdowns

Oct 3, 2005

For some reason my SQL Server slows down throughout the day for no apparent reason..

The database is 100 gig transaction replicated to 2 data warehouses.

Ive done the usual stuff like monitoring processes killing off blocking transactions but it doesn't seem to do the trick.

There are no jobs running at the point of slow-down so at this current time I am a little lost.

Is there some way to determine why these slow-downs are happening ?

The system becomes completely un-responsive during these periods !!
HELP !! :eek:

View 4 Replies View Related

4 Ways To Know The Record Count Of A Table

Nov 28, 2005

Please tell me the 4 ways to know the record count of a table?

View 14 Replies View Related

Ways Of Connecting To Remote Databases

Mar 15, 2004

Hi everyone.

I need to know which are the best ways to connect to a remote SQL SERVER 2000 from inside a VB6 application. By remote I mean on a dedicated server outside my LAN that I can access by IP address.

Any opinion would be appreciated.

View 3 Replies View Related

Ways To Improve Views Performance

Jan 19, 2008

Dear All,
i've tried with indexed views, but because the view is referenceing another view, i was unable to create a clustered index on that view.
so please let me know how can i improve the performance of the view.

thank you very much

Vinod
Even you learn 1%, Learn it with 100% confidence.

View 1 Replies View Related

How Many Ways We Can Link A Remote Server?

Mar 18, 2008

How many ways we can link a remote server?

I know we can do using linkedserver . Is there any others to do?

View 2 Replies View Related

What Are The Different Ways Of Comparing Sql Server Databases

Jan 2, 2007



Hi

can anybody tell how to compare two databases on sql server



thank u

vizai

View 3 Replies View Related

Other Ways To Execute Integration Package?

Jun 9, 2006

Hi all,
I am just wondering is there any other ways to execute an integration service package other than using sql server agent, dos command and manually execute the package in BIDS? I am thinking of running the package on web, is this possible?
What I am trying to do is let user to run the integration service when they need to, so instead using SQL Server Management Studio to run the task being set in SQL Server Agent, I am thinking of something where user can log into a website (like the report server) and then run the integration, so that the data for the report server's reports are being update. Please help out if any know a solution to it. Thanks in advance.

Daren

View 1 Replies View Related

Different Ways To Count Data Rows?

Aug 21, 2015

I want to know that how many ways we have to count the data in sql.

I know only one way..that is. using count keyword.. are their any ways to find out the other ways..

View 2 Replies View Related

Ways Of Transferring Database Between Two Different Servers

Dec 1, 2006

hello friends,


I need to transfer my database from one server to database on another server every 24 hours. I can create windows application but it will be cumbersome to write bulk of code . So can u suggest me some service or any other way through query or stored procedure or by job scheduling which can run every 24 hours and move my data from one database on one server to another sql database. Both database systems are sql server 2000 but servers are diffeerent so how to connect them while transferring dbs. ? Any help is appreciated.

regards,
max

View 1 Replies View Related

I Wasnt To Learn All The Possible Ways Of Accessing Data In ASP .net 2.0

Oct 5, 2007

Hello.I would like to learn all the possible ways that we can access and modify data in ASP .net 2.0 programmatically.for example one way would be like this: StringBuilder sql = new StringBuilder();sql.Append(" SELECT *");        //count the total number of recordssql.Append(" FROM dbo.tblJobTitle ");  //get the connection string from web servicesstring strConnection = new sqlconnection.SQLConnection().GetSQLConnectString(sqlconnection.SQLDSN.SCIC);//Use the Microsoft.practices SqlDatabase object to execute our sql.SqlDatabase SqlHelper = new SqlDatabase(strConnection);SqlDataReader reader = (SqlDataReader)SqlHelper.ExecuteReader(CommandType.Text, sql.ToString());the i can loop through reader and get the data OR I can create a DataSet like this: SqlDatabase db = new SqlDatabase(strConnection);
DbCommand dbCommand = db.GetSqlStringCommand(sql.ToString());
DataSet dst = db.ExecuteDataSet(dbCommand);I want to know if there is a comprehensive book explainaning all these possible ways to access and modify data using C#  under ASP .net 2.0I really really apreciate this.Thank you very much.   

View 3 Replies View Related

DB Engine :: Possible Ways To Execute A Query Joining Three Tables

May 16, 2015

I am learning the Optimizer from the book "Querying Microsoft SQL Server 2012" for certificate exam 70-461. I really cannot understand how it explains the number of possible ways to execute a query joining three tables. the pseudo-query is:

SELECT A.col5, SUM(C.col6) AS col6sum
FROM TableA AS A
INNER JOIN TableB AS B
ON A.col1 = B.col1
INNER JOIN TableC AS C
ON B.col2 = c.col2
WHERE A.col3 = constant 1
AND B.col4 = constant2
GROUP BY A.col5;

The book says:"Start with the FROM part. Which tables should SQL Server join first, TableA and TableB or TableB and TableC? And in each join, which of the two tables joined should be the left and which one the right table? The number of all possibilities is six, if the two joins are evaluated linearly, one after another."

Q1: How could it be six possibilities? From my understanding, lets say, if the SQL Server has to join A and B first, and then join C, in this case I can think of 4 possibilities, which are:

1. When A Join B, Left: A, Right: B.
    When Join C, Left: result of A join B, Right: C

2. When A Join B, nbsp;  
When Join C, nbsp;When A Join B, nbsp;  
When Join C, nbsp;When A Join B, nbsp;   
When Join C, "line-height:13.5px;">

Q2: The section following the previous question says there are 4 different types of join.."This already gives four options for each join. So far, there are 6 x 4 = 24 different options for only the FROM part of this query."

How can it be 6 x 4? My understanding is 4 is only for 1 join, but in our case, there are 2 joins, so it should be 6 x 4 x 4.

View 4 Replies View Related

Ways/Suggestions For Increasing The Security For SQL Server 2005

Jan 14, 2007

Hi guys , is there any ways/suggestions for strengthen up the security for SQL server 2005 ? Due to several attacks from unknown places to my database's server , so I would like to get a way for increase the SQL security. Hope able to gather some info from web as well. Thx a lot guys.

Best Regards,

Hans

View 5 Replies View Related

SQL Server 2012 :: Ways To Improve Record Deletion Speed

Oct 13, 2015

I have a table (F_POLICY_TRANSACTION).This table has a couple of million rows in it.I am using a column named POLICY_TRANSACTION_BKEY to select records to delete (approximately 750k using the code below)This column has a non-clustered index applied..This is the code I have used:

WHILE 1 = 1
BEGIN
DELETE TOP(50000)
FROM F_POLICY_TRANSACTION with (tablockx)

[code]....

Problem is, it takes around 10 minutes to run.Is there any way it can be made more efficient?I have tried varying the rowcount with no success

View 9 Replies View Related

How Many Ways Are Provided By Microsoft To Import Data Into SQL Mobile Database?

Dec 15, 2006

SQL Mobile database seems to not provide import/export utilities.

I think using Publication/Subscription is one of the solution, is it right?

Also, besides typing insert statement manually, there are any other ways to transform data to the SQL Mobile database?

View 3 Replies View Related

Ways To Make This Work: Several Selectable Related Record For One Main Record.

Apr 6, 2007

Hey all!



Sorry for the less then descriptive post title but I didn't find a better way to describe it. I'm developing an app in the express editions of VB and SQLserver. The application is a task/resource scheduler. The main form will have a datepicker or weekly overview and show all tasks scheduled per day. The problem is, I've got one or more people assigned to tasks and I wonder what's the best way to design this. Personally, I'd go for one Task table, a People table and a table that provides a link between them (several record per task, one for each person assigned linking TaskID and PplID). However, I don't see a nice way of showing this data to the end user, allowing him to edit/add etc on ONE screen.

To fix that the only way I see is just add columns to the Task table for every person with select boxes. This way everything can be done on one simple screen. This obviously does present some future issues.

On top of this, which people are available on a day varies and there should be an option to allow a user to set who is available on a specific day. Which would lead me to my first idea and add another table that would provide this. but then I'm having design issues again for the form.



I'm kinda stuck atm, can anyone shed some light on this. I'm sure there is an elegant way of doing this but I'm failing at finding it.



Thanks in advance,

Johan

View 5 Replies View Related

Integration Services :: Add New Column Based On Existing Column Using Derived Column Task?

Jul 28, 2015

I have a excel file which has a column called "Code" and their values are A,B,C,D,E,F,G,H.  I want to create a new column called "status" based on the values of "Code".

Code:

A
B
C
D
E
F
G
H

If A,C,E,G then "status" = "Active" else if  B,D,F,H then "Status" = "Inactive". I like to do it using "Derived Column".

View 4 Replies View Related

Transact SQL :: Calculate DateTime Column By Merging Values From Date Column And Only Time Part Of DateTime Column?

Aug 3, 2015

How can I calculate a DateTime column by merging values from a Date column and only the time part of a DateTime column?

View 5 Replies View Related

How To Refer A Column When The Referencing Column Is An Identity Column

Oct 16, 2006

Hi all,

The requirement is to have a table say 'child_table', with an Identity column to refer another column from a table say 'Parent_table'..

i cannot implement this constraint, it throws the error when i execute the below Alter query,

ALTER TABLE child_table ADD CONSTRAINT fk_1_ct FOREIGN KEY (child_id)
REFERENCES parent_table (parent_id) ON DELETE CASCADE

the error thrown is :
Failed to execute alter table query: 'ALTER TABLE child_table ADD CONSTRAINT
fk_1_ct FOREIGN KEY (child_id) REFERENCES parent_table (parent_id) ON DELETE
CASCADE '. Message: java.sql.SQLException: Cascading foreign key 'fk_1_ct' cannot be
created where the referencing column 'child_table.child_id' is an identity column.

any workarounds for this ?

View 3 Replies View Related

TSQL - Using ALTER TABLE - ALTER COLUMN To Modify Column Type / Set Identity Column

Sep 7, 2007

Hi guys,
If I have a temporary table called #CTE
With the columns
[Account]
[Name]
[RowID Table Level]
[RowID Data Level]
and I need to change the column type for the columns:
[RowID Table Level]
[RowID Data Level]
to integer, and set the column [RowID Table Level] as Identity (index) starting from 1, incrementing 1 each time.
What will be the right syntax using SQL SERVER 2000?

I am trying to solve the question in the link below:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2093921&SiteID=1

Thanks in advance,
Aldo.

I have tried the code below, but getting syntax error...



ALTER TABLE #CTE
ALTER COLUMN
[RowID Table Level] INT IDENTITY(1,1),
[RowID Data Level] INT;


I have also tried:

ALTER TABLE #CTE
MODIFY
[RowID Table Level] INT IDENTITY(1,1),
[RowID Data Level] INT;







View 18 Replies View Related

Alter Table Add Column - How Do You Add A Column After Say The Second Column

Jul 11, 2007



When you use "Alter Table add Column", it adds the column to the end of the list of fields.



How do you insert the new column to position number 2 for instance given that you may have more than 2 columns?



Create table T1 ( a varchar(20), b varchar(20), c varchar(20))



Alter table add column x varchar(20)

so that the resulting table is

T1 a varchar(20), x varchar(20), b varchar(20), c varchar(20)



Can this be done programmatically?













View 33 Replies View Related

ALTER TABLE DROP COLUMN LastUpdated Failed Because One Or More Objects Access This Column.

Mar 7, 2008

Hi I’m trying to alter a table and delete a column I get the following error. The object 'DF__Morningst__LastU__19EB91BA' is dependent on column 'LastUpdated'.
ALTER TABLE DROP COLUMN LastUpdated failed because one or more objects access this column. I tried deleting the concerned constraint. But the next time I get the same error with a different constraint name. I want to find out if I can dynamically check the constraint name and delete it and then drop the column. Can anyone help.IF EXISTS(SELECT 1FROM sysobjects,syscolumnsWHERE sysobjects.id = syscolumns.idAND sysobjects.name = TablenameAND syscolumns.name = column name)BEGIN EXECUTE ('ALTER TABLE tablename DROP CONSTRAINT DF__SecurityM__DsegL__08C105B8')EXECUTE ('ALTER TABLE tablenameDrop column columnname)ENDGO
 

View 1 Replies View Related

Exclude Records From A Table Where ID Column Is Same But Mail Code Column Is Multi-valued

Nov 12, 2012

I am trying to exclude records from a table where the ID column is the same but the Mail code Column is multi-valued.For Example: (the table looks like....)

ID Mail_code
111111 XNT
111111 N11
111111 XNC
222222 XNC
222222 XNL
333333 XNC

So, if there is any ID that has a value of XNC, I want to exclude the ID all together from my output regardless of the other values.

View 3 Replies View Related

SQL Server 2008 :: Display A Column Alias As Part Of The Result Set Column Labels?

Feb 26, 2015

Is there a way to display a column alias as part of the result set column labels?

View 9 Replies View Related







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