MULTIPLI FILED COUNT

Apr 20, 2008

HELLO FRIENDS

HOW YOU DOING ? HOPE FINE AND HAPPY

I BIG PROBLEM WHICH IS SMALL FOR YOU

HERE IS MY SQL STATMENT

SQLString = "select F01,F02,F03,F04,F05,F06,F07 from MovementTable where f011= KLM and f06 between 2 and 4"

HOW CAN HAVE COUNT IF F02=3 , F03=4 ,F04=5 THE TOTAL SHOULD BE =12

THANKS IN ADVANCE

View 12 Replies


ADVERTISEMENT

How To Increment Datetime Value In One Filed By Integer Value In Another Filed

Feb 12, 2008

hello everone i have a table named "Concerned_Department" in which i ve a filed "Deadline"of type DateTime.i ve another table named "Cat_description" in wh i ve a filed "Max_Days"of type int in wh i ve values 1,2 and 3.in "Cat_Description" table i ve "Cat_ID" as Primary key of type int.all i want is if i select a row from "Cat_description" with "Max_Days"=1, i want to add this 1 to current date and and place it in the "deadline" field of "Concerned_Department" table.like if today is 12/02/2008 then i want to place 13/02/2008 in "Deadline" filed of "Concerned_Deprtment"tablewhen a row with "Max_Days"=1 from "Cat_Description" is selected.i am using SQL SERVER 2005 Exprees and C#(in source behind).regardsAhmed Bilal Jan

View 2 Replies View Related

How Is It Possible To Set A Filed In A Database To Automatically Add The Current Time To The Filed At Run Time?

Oct 25, 2007

how is it possible to set a filed in a database to automatically add the current time to the filed at run time, is this possible; this filed has already been identified as 'DateTime' .

View 4 Replies View Related

I Only Want The First 50 Bytes Of The Filed :(

Apr 6, 2004

My database has chinese characters in.
Eventually I need to only get the first 50 bytes of the data field, but somehow, I use len('==data==',50), it would catch 50 chinese characters which make 100 bytes ...
can anyone help me?
Thank you very much no matter what the result is ;)

View 1 Replies View Related

Update Filed ?

Apr 22, 2008

Hello,

i have a table with million record, an bigint filed like:

ID Name
-------------------------------------
1 Adam
4 Bob
5 Daivid
100 ...

Also i have unique index on filed ID, i want update this filed for any row to get row number and to be like:

ID Name
-------------------------------------
1 Adam
2 Bob
3 Daivid
4 ...


Can any one show me sample code ?

Kind Regards,
sasan.

View 6 Replies View Related

How To Put Formula In Sql Filed

Apr 18, 2007

i have two tables .Table 1 contains certain columns with values.Table 2 shud get those data from table1 into its column and display the calculated result. Any idea how do i go abt it,bcuz table2 shud contain a formula so as to calculate.

View 5 Replies View Related

Is There Password Filed In SQL 2000 ?

Feb 10, 2004

I don't know there is Password filed in SQL 2000 or not ?
If there is not , then How to hidden password in database.
pls help me !

View 1 Replies View Related

Sum Of One Filed Based On Value Of Another Field

Apr 18, 2008

Hi All,

For one of my reports, I need a expression smthing like this.


=IIf(Fields!Category.Value = "Decisioned" , THEN SHOW SUMMATION OF TOTAL APPLICATIONS WHERE Catergory = "Decisioned ," ")


Can anyone help me to write this expression.

Thanks

View 3 Replies View Related

How Can I Make Datatime Filed A Blank?

Aug 14, 2001

How can I make datatime filed a blank?

For example,


create table abc (day1 datetime, day2 datetime)
insert into abc values ('2001-08-09, '2001-08-13')
insert into abc values ('2001-08-10, '')
insert into abc values ('2001-08-11', '2001-08-15')

If i execute the above sql then I will have,

Day1 day2
==== ====
2001-08-09 2001-08-13
2001-08-10 1900-01-01
2001-08-11 2001-08-15

But I want to have the following result,
Day1 day2
==== ====
2001-08-09 2001-08-13
2001-08-10
2001-08-11 2001-08-15

How can I insert blank value in day2 column?
Thanks in advance

View 1 Replies View Related

Auto Increment On A Filed In A Table

Oct 20, 2004

I have a table with two primary key fileds. I will be running a process to populate the data into the table.For each process the first field is constant and second field is auto increment one.

My statements are insert into select ** from ** type one.

How do I auto increment second filed per run. Any delivered function available or any suggestion Pl.................

View 4 Replies View Related

SQL 2012 :: Concatenate A Filed If Rows Have Same ID?

Jul 23, 2015

I want to CONCATENATE a field if the rows have the same Id. For example the data looks like

ID Name Identifier
1 ken English
1 Jack French
2 Jamie Spanish
3 Shirley German

The data should look like this if the IDs are same. I am concatenating the Identifier column with the name if the ids are same

ID Name Identifier
1 Ken English English
1 Jack French French
2 Jamie Spanish
3 Shirley German

View 8 Replies View Related

Only Save Date In Datetime Filed

Apr 14, 2008

Hi

I'm having two datetime field in my table. One is Call date and another one is Calltime because of some calculations. So I want to save calldate like 4/14/2008 and calltime like 9:30 PM.

Kindly help me.

View 3 Replies View Related

SQL Command ToFill Empty Filed

Jun 18, 2007

Hello there

How are you? Hope fine and healthy

I have hug database which contain empty filed, I would like to fill the empty filed by inserting 0 in each empty filed using SQL command

May I have help please?

Thanks in advance

View 2 Replies View Related

Export To Fixed Filed Size

Aug 24, 2006

Hello I need to export my table fixed filed size by making numbers 15 characters right alignment and strings 20 characters left alignment.

View 1 Replies View Related

Export To Table Fixed Filed Size

Aug 24, 2006

Hello I need to export my table fixed filed size by making numbers 15 characters right alignment and strings 20 characters left alignment.

View 3 Replies View Related

How Can I Add Pictures To My Database Filed In Design View?

Nov 7, 2007

I have a database called ‘Objects’ which has many field. One of its fields is called ‘Image’ and has a data type image. 
I want to add pictures to each one of my records offline, is this possible?  i.e. by copying the address from my C drive such as C:Documents and SettingsfseyedarabiMy DocumentsMy Pictures
 

View 1 Replies View Related

Hoe To Insert Email Address Into The Database Filed

Feb 13, 2008

i ve a filed named "Email" of datatype .i ve created this field to insert email address in this field.but when i insert an email address like "bilal@yahoo.com" from a textbox wh is in an ASP.net webpage then in the filed i see this "System.Web.UI.WebControls.TextBox".
can u plz tell me how to fix this
Regards
Ahmed Bilal Jan

View 3 Replies View Related

Which Filed Type Is Substitute Of MEMO In SQL Server?

Jun 3, 2004

Hi,


I need to store large note in SQL Server field, what is substitute of Access's Memo filed in SQL Server?

Appreciated...

View 6 Replies View Related

Auto Number Filed Insert Problem

Jun 7, 2006

i am trying to insert an auot number field in my table which has got about million rows but sql 2005 is giving me na error "cant insert"
i need to index my table so that the query runs faster when i perform joins on two of such huge tables..
i tryid inserting the identity key the way it was mentioned in the forum but sql doesnt let me do that??

pls help

View 9 Replies View Related

Validating Date Via An Derived Filed/expression

Apr 8, 2008

How can I validate the date that is coming across in a 8 byte character field via an expression? It will either be a valid date or 0. If it is zero I want to make it a null.

View 1 Replies View Related

How Can I Create An Image Filed In My Database Using Sql Server And VB Language?

Oct 30, 2007

I have a database called 'objects' with one of its fields called 'Image' (data type is set to image) and a file in my desk top labelled as 'Pictures' (this is where all my pictures are keep). At run time i want to be able to select and add (upload) my preferred picture to the image filed of different records. Could you please advice me what i should do?

View 9 Replies View Related

Manipulating Text,nText Data Types Filed In Tsql

Jul 12, 2006

I have to run a dynamic sql that i save in the database as a TEXT data type(due to a large size of the sql.) from a .NET app.  Now i have to run this sql from the stored proc that returns the results back to .net app. I am running this dynamic sql with sp_executesql like this..
EXEC sp_executesql @Statement,N'@param1 varchar(3),@param2 varchar(1)',@param1,@param2,GO
As i can't declare text,ntext etc variables in T-Sql(stored proc), so i am using this method in pulling the text type field "Statement".
DECLARE @Statement varbinary(16)SELECT @Statement = TEXTPTR(Statement)FROM table1 READTEXT table1.statement @Statement 0 16566
So far so good, the issue is how to convert @Statment varbinary to nText to get it passed in sp_executesql.
Note:- i can't use Exec to run the dynamic sql becuase i need to pass the params from the .net app and Exec proc doesn't take param from the stored proc from where it is called.
I would appreciate if any body respond to this.
 
 
 

View 2 Replies View Related

Can We Pass Filed Name And Table Name As Parameter To User Defined Functions

Dec 29, 2005

Hi,
Following is the user defined function I want to get maximum value. It gives man an error "@strTableName must declare"


CREATE FUNCTION dbo.GetMaximum
(
@strFieldNamenvarchar(255),
@strTableName nvarchar(255)

)
RETURNS nvarchar(255)
AS
BEGIN

DECLARE @maxID int


SELECT @maxID=(SELECT IsNull(MAX(@strFieldName),0)+1 FROM @strTableName )

RETURN (@maxID)

END

View 5 Replies View Related

Create Delete Trigger On Table1 To Update A Filed On Table2

Jan 11, 2008

Hi everyoneI am trying to create a DELETE Trigger. I have 2 tables. Table1 andTable2. Table 2 has all the same fields and records as Table1 + 1extra column "date_removed"I would like that when a record is deleted from Table 1, the triggerfinds that record in Table2 and updates the date_removed filed withcurrent time stamp.The primary key on both is combination of domain,admin_group and cn.CREATE TRIGGER [tr_updateTable2] ON [dbo].tbl_Table1FOR DELETEASUpdate Table2SET date_removed = getDate()I'm stuck here, how do I manipulate on Table2 only the records thatwere deleted on Table1, so to only update date_removed filed for themin Table2?I guess i need to compare domain, cn and admin_group, but I don't knowhow.Any help would be greatly appreciatedThanks! :-)

View 3 Replies View Related

Transaction Count After EXECUTE Indicates That A COMMIT Or ROLLBACK TRANSACTION Statement Is Missing. Previous Count = 1, Current Count = 0.

Aug 6, 2006

With the function below, I receive this error:Error:Transaction count after EXECUTE indicates that a COMMIT or ROLLBACK TRANSACTION statement is missing. Previous count = 1, current count = 0.Function:Public Shared Function DeleteMesssages(ByVal UserID As String, ByVal MessageIDs As List(Of String)) As Boolean        Dim bSuccess As Boolean        Dim MyConnection As SqlConnection = GetConnection()        Dim cmd As New SqlCommand("", MyConnection)        Dim i As Integer        Dim fBeginTransCalled As Boolean = False
        'messagetype 1 =internal messages        Try            '            ' Start transaction            '            MyConnection.Open()            cmd.CommandText = "BEGIN TRANSACTION"            cmd.ExecuteNonQuery()            fBeginTransCalled = True            Dim obj As Object            For i = 0 To MessageIDs.Count - 1                bSuccess = False                'delete userid-message reference                cmd.CommandText = "DELETE FROM tblUsersAndMessages WHERE MessageID=@MessageID AND UserID=@UserID"                cmd.Parameters.Add(New SqlParameter("@UserID", UserID))                cmd.Parameters.Add(New SqlParameter("@MessageID", MessageIDs(i).ToString))                cmd.ExecuteNonQuery()                'then delete the message itself if no other user has a reference                cmd.CommandText = "SELECT COUNT(*) FROM tblUsersAndMessages WHERE MessageID=@MessageID1"                cmd.Parameters.Add(New SqlParameter("@MessageID1", MessageIDs(i).ToString))                obj = cmd.ExecuteScalar                If ((Not (obj) Is Nothing) _                AndAlso ((TypeOf (obj) Is Integer) _                AndAlso (CType(obj, Integer) > 0))) Then                    'more references exist so do not delete message                Else                    'this is the only reference to the message so delete it permanently                    cmd.CommandText = "DELETE FROM tblMessages WHERE MessageID=@MessageID2"                    cmd.Parameters.Add(New SqlParameter("@MessageID2", MessageIDs(i).ToString))                    cmd.ExecuteNonQuery()                End If            Next i
            '            ' End transaction            '            cmd.CommandText = "COMMIT TRANSACTION"            cmd.ExecuteNonQuery()            bSuccess = True            fBeginTransCalled = False        Catch ex As Exception            'LOG ERROR            GlobalFunctions.ReportError("MessageDAL:DeleteMessages", ex.Message)        Finally            If fBeginTransCalled Then                Try                    cmd = New SqlCommand("ROLLBACK TRANSACTION", MyConnection)                    cmd.ExecuteNonQuery()                Catch e As System.Exception                End Try            End If            MyConnection.Close()        End Try        Return bSuccess    End Function

View 5 Replies View Related

Analysis :: Count Function Taking More Time To Get Count From Parent Child Dimension?

May 25, 2015

below data,

Countery
parentid
CustomerSkId
sales

A
29097
29097
10

A
29465
29465
30

A
30492
30492
40

[code]....
 
Output

Countery
parentCount

A
8

B
3

c
3

in my count function,my code look like,

 set buyerset as exists(dimcustomer.leval02.allmembers,custoertypeisRetailers,"Sales")
set saleset(buyerset)
set custdimensionfilter as {custdimensionmemb1,custdimensionmemb2,custdimensionmemb3,custdimensionmemb4}
set finalset as exists(salest,custdimensionfilter,"Sales")
Set ProdIP as dimproduct.dimproduct.prod1
set Othersset as (cyears,ProdIP)
(exists(([FINALSET],Othersset,dimension2.dimension2.item3),[DimCustomerBuyer].[ParentPostalCode].currentmember, "factsales")).count

it will take 12 to 15 min to execute.

View 3 Replies View Related

Count For Varchar Field - How To Get Distinct Count

Jul 3, 2013

I am trying to get count on a varchar field, but it is not giving me distinct count. How can I do that? This is what I have....

Select Distinct
sum(isnull(cast([Total Count] as float),0))

from T_Status_Report
where Type = 'LastMonth' and OrderVal = '1'

View 9 Replies View Related

In SQL 2000 Can I Use Count() To Count A Column?

Nov 26, 2007

I use SQL 2000
I have a Column named Bool , the value in this Column is  0ã€?0ã€?1ã€?1ã€?1
I no I can use Count() to count this column ,the result would be "5"
but what I need is  "2" and "3" and then I will show "2" and "3" in my DataGrid
as the True is  2 and False is 3
the Query will have some limited by a Where Query.. but first i need to know .. how to have 2 result count
could it be done by Count()? please help.  
thank you very much
 

View 5 Replies View Related

Table Row Count + Index Row Count

Jul 23, 2005

SQL 2000I have a table with 5,100,000 rows.The table has three indices.The PK is a clustered index and has 5,000,000 rows - no otherconstraints.The second index has a unique constraint and has 4,950,000 rows.The third index has no constraints and has 4,950,000 rows.Why the row count difference ?Thanks,Me.

View 5 Replies View Related

Obtain Unit Percent With Unit Count Divided By Total Count In Query

Aug 21, 2007

The following query returns a value of 0 for the unit percent when I do a count/subquery count. Is there a way to get the percent count using a subquery? Another section of the query using the sum() works.

Here is a test code snippet:


--Test Count/Count subquery

declare @Date datetime

set @date = '8/15/2007'


select
-- count returns unit data
Count(substring(m.PTNumber,3,3)) as PTCnt,
-- count returns total for all units

(select Count(substring(m1.PTNumber,3,3))

from tblVGD1_Master m1

left join tblVGD1_ClassIII v1 on m1.SlotNum_ID = v1.SlotNum_ID

Where left(m1.PTNumber,2) = 'PT' and m1.Denom_ID <> 9

and v1.Act = 1 and m1.Active = 1 and v1.MnyPlyd <> 0

and not (v1.MnyPlyd = v1.MnyWon and v1.ActWin = 0)

and v1.[Date] between DateAdd(dd,-90,@Date) and @Date) as TotalCnt,
-- attempting to calculate the percent by PTCnt/TotalCnt returns 0
(Count(substring(m.PTNumber,3,3)) /

(select Count(substring(m1.PTNumber,3,3))

from tblVGD1_Master m1

left join tblVGD1_ClassIII v1 on m1.SlotNum_ID = v1.SlotNum_ID

Where left(m1.PTNumber,2) = 'PT' and m1.Denom_ID <> 9

and v1.Act = 1 and m1.Active = 1 and v1.MnyPlyd <> 0

and not (v1.MnyPlyd = v1.MnyWon and v1.ActWin = 0)

and v1.[Date] between DateAdd(dd,-90,@Date) and @Date)) as AUPct
-- main select

from tblVGD1_Master m

left join tblVGD1_ClassIII v on m.SlotNum_ID = v.SlotNum_ID

Where left(m.PTNumber,2) = 'PT' and m.Denom_ID <> 9

and v.Act = 1 and m.Active = 1 and v.MnyPlyd <> 0

and not (v.MnyPlyd = v.MnyWon and v.ActWin = 0)

and v.[Date] between DateAdd(dd,-90,@Date) and @Date

group by substring(m.PTNumber, 3,3)

order by AUPct Desc


Thanks. Dan

View 1 Replies View Related

Inserted Rows Count From SSIS Not Like Table Rows Count

Jun 25, 2007

Hi all



i using lookup error output to insert rows into table

Rows count rows has been inserted on the table 59,123,019 mill

table rows count 6,878,110 mill ............................



any ideas

View 6 Replies View Related

Count(*) Vs Count(columnname)

Aug 28, 2007

 Is there a difference in performance when using count(*) or count(columnname)?

View 10 Replies View Related

SQL Query Automatically Count Month Events B4 Today; Count Events Today + Balance Of Month

Mar 20, 2004

I would like to AUTOMATICALLY count the event for the month BEFORE today

and

count the events remaining in the month (including those for today).

I can count the events remaining in the month manually with this query (today being March 20):

SELECT Count(EventID) AS [Left for Month],
FROM RECalendar
WHERE
(EventTimeBegin >= DATEADD(DAY, 1, (CONVERT(char(10), GETDATE(), 101)))
AND EventTimeBegin < DATEADD(DAY, 12, (CONVERT(char(10), GETDATE(), 101))))

Could anyone provide me with the correct syntax to count the events for the current month before today

and

to count the events remaining in the month, including today.

Thank you for your assistance in advance.

Joel

View 1 Replies View Related







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