Correct The Error

May 29, 2008

Hi friends,
I've created one procedure.I'm trying to execute that i got the error message like 'Must declare the scalar variable @series'.
but i declared it already.Table name starts with SI,dont have the fields like series and hono.I dont know how to correct this error.Please help me out.Here is my procedure.

alter proc procinsertAllFields
as
begin
declare @series varchar(10)
declare @hono varchar(5)
declare @tabname varchar(8)
declare @sql nvarchar(500)
if exists (select * from sysobjects where name=ltrim(rtrim('ccno_dir1')))
drop table ccno_dir1
set @sql='create table ccno_dir1(cc_no varchar(20),series varchar(1),
hono varchar(10),denom_code varchar(10),i_date datetime,d_date datetime,
locked varchar(10),csd_no varchar(10),invoice_no int,invoice_date datetime)'--print @sql
exec sp_executesql @sql

declare c cursor
for
select series=substring(name,3,1),hono =substring(name,4,5),name from sysobjects where name like 'si[1-3]_____'
open c
fetch next from c into @series,@hono,@tabname
while @@fetch_status=0
begin
print 'begin'
fetch next from c into @series,@hono,@tabname
set @sql='insert into ccno_dir1(cc_no,series,hono,denom_code,i_date,d_date,locked,csd_no,invoice_no,invoice_date)
select cc_no,series=@series,hono=@hono,denom_code,i_date,d_date,locked,csd_no,invoice_no,
invoice_date from '+@tabname
print @sql
exec sp_executesql @sql

end
close c
deallocate c
end

Thanks in advance!

kiruthika
http://www.ictned.eu

View 3 Replies


ADVERTISEMENT

How To Get The Correct Error Message

Jan 28, 2004

Hi Everyone!

In my stored procedure I check for any errors during .
If there are any errors I log them. (by checking @@ERROR)

What my problem is, the error message that's been logged contain place holders like %s, %l, %d,etc. along with the error message.

How can I get the full error message, with place holders replaced by real error values/text?

Here is a sample what I get as the error:

* Error ID: 547
* Error Desc: %ls statement conflicted with %ls %ls constraint '%.*ls'. The conflict occurred in database '%.*ls', table '%.*ls'%ls%.*ls%ls.

using this query
SELECT @errdesc=description FROM master.dbo.sysmessages WHERE error = @errid


When I run the stored proc in Query Analyser it gives the actual error message as:

Server: Msg 547, Level 16, State 1, Procedure sp_register_change, Line 366
INSERT statement conflicted with COLUMN FOREIGN KEY constraint 'FK_TBL_EQUIPMENT'. The conflict occurred in database 'EquipManWT', table 'TBL_EQUIPMENT', column 'unitno'.
The statement has been terminated.



Thanks heaps,

rochana

View 6 Replies View Related

Unsure Of Where To Correct Error

Aug 28, 2006

Hi everyone,
I am a relative newbie to SQL and trying to do things via the self-taught method. I really have an issue that I am just unsure of what to do. I am working with a procedure that is for emailing invoices to customers. There can only be one account for a primary email address. From time to time a user will assign a second account to the email address. When the process runs, it sees the error and will not continue processing the remaining records. Any suggestions as to what I might be able to do? I need to have it so that the remaining records will process. (I think it may be important to note this is an application on a company intranet site.)
Thanks for any help you can provide.

View 7 Replies View Related

Please Correct This Error While I Retriving Image From Database

Sep 4, 2007

private void Page_Load(object sender, System.EventArgs e){    // Put user code to initialize the page here    MemoryStream stream = new MemoryStream ();    SqlConnection connection = new       SqlConnection (@"...");    try    {        connection.Open ();        SqlCommand command = new           SqlCommand ("select Picture from Image", connection);        byte[] image = (byte[]) command.ExecuteScalar ();           stream.Write (image, 0, image.Length);        Bitmap bitmap = new Bitmap (stream);        Response.ContentType = "image/gif";        bitmap.Save (Response.OutputStream, ImageFormat.Gif);    }     finally    {        connection.Close ();        stream.Close ();    }
Error:       byte[] image = (byte[]) command.ExecuteScalar ();   
Unable to cast object of type 'System.Int32' to type 'System.Byte[]'.

View 1 Replies View Related

Input String Was Not In A Correct Format. Error

Apr 16, 2008

I have a page where user can insert a new record, i use stroed procedures:ALTER PROCEDURE [dbo].[sp_InsertTypes]
@Type varchar(10),
@Type_Desc varchar(35),
@Contact_Name varchar(20),
@Contact_Ad1 varchar(25),
@Contact_Ad2 varchar(25),
@Contact_City varchar(10),
@Contact_Phone varchar(12),
@Contact_Fax varchar(12),
@Contact_Email varchar(35)
Insert into dbo.Types (Type,Type_Desc,Contact_Name,Contact_Ad1,Contact_Ad2,Contact_City,Contact_Phone,
Contact_Fax,Contact_Email) values (@Type,@Type_Desc,@Contact_Name,@Contact_Ad1,@Contact_Ad2,@Contact_City,
@Contact_Phone, @Contact_Fax,@Contact_Email)
My code is:Protected Sub InsertButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
Dim myConnection As New SqlConnection(ConfigurationManager.ConnectionStrings("myConnectionString").ConnectionString)Dim myCommand As SqlCommand
Dim TypeTxt As TextBox = FormView1.FindControl("TypeTextBox")Dim DescTxt As TextBox = FormView1.FindControl("TypeDescTextBox")
Dim NameTxt As TextBox = FormView1.FindControl("ContactNameTextBox")Dim phoneTxt As TextBox = FormView1.FindControl("ContactPhoneTextBox")
Dim ad1Txt As TextBox = FormView1.FindControl("ContactAd1Textbox")Dim ad2Txt As TextBox = FormView1.FindControl("ContactAd2Textbox")
Dim cityTxt As TextBox = FormView1.FindControl("ContactCityTextbox")Dim faxTxt As TextBox = FormView1.FindControl("ContactFaxTextbox")
Dim emailTxt As TextBox = FormView1.FindControl("ContactEmailTextbox")myCommand = New SqlCommand("[dbo].[sp_Insert_Types]", myConnection)
myCommand.CommandType = CommandType.StoredProcedure
myCommand.Parameters.Add("@Type", SqlDbType.BigInt).Value = TypeTxt.Text
myCommand.Parameters.Add("@Type_Desc", SqlDbType.VarChar).Value = DescTxt.Text
myCommand.Parameters.Add("@Contact_Name", SqlDbType.VarChar).Value =  NameTxt.Text
myCommand.Parameters.Add("@Contact_Phone", SqlDbType.VarChar).Value = phoneTxt.Text
myCommand.Parameters.Add("@Contact_Ad1", SqlDbType.VarChar).Value = ad1Txt.Text
myCommand.Parameters.Add("@Contact_Ad2", SqlDbType.VarChar).Value = ad2Txt.Text
myCommand.Parameters.Add("@Contact_City", SqlDbType.VarChar).Value =  cityTxt.Text
myCommand.Parameters.Add("@Contact_Fax", SqlDbType.VarChar).Value =  faxTxt.Text
myCommand.Parameters.Add("@Contact_Email", SqlDbType.VarChar).Value = emailTxt.Text myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()
End Sub
 I have almost the identical procedure & code for Update command button, and worked well, what am I doing wrong? I even tried adding ' in front and after the texts.
Thank you.

View 5 Replies View Related

Help With Input String Was Not In A Correct Format Error

May 29, 2008

I am trying to execute an SQL update statement as follows:myObj.Query("Update Schedule Set visitorScore=" + t1 + ", homeScore=" + t2 + " where id=" + Convert.ToInt16(HID.Value));However, I'm getting the following error message with regards to this line.: Exception Details: System.FormatException: Input string was not in a correct format.  Could anyone please tell me what is wrong with this line?  I have tried many different versions of this, but keep getting the same error. THANKS IN ADVANCE! 

View 3 Replies View Related

Error: Input String Was Not In A Correct Format?

Oct 20, 2005

Hi experts,  I am working on my asp.net application and received an error message on   dr = cmdGetFile.ExecuteReader:Error: Input string was not in a correct format. Can someone help me out of this?  Thank you in advance.------------------------------------------------------------------------------------ #Region " Web Form Designer Generated Code "
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()        Me.cmdGetFile = New System.Data.SqlClient.SqlCommand        Me.dbHRConn = New System.Data.SqlClient.SqlConnection        '        'cmdGetFile        '        Me.cmdGetFile.CommandText = "SELECT App_Resume_FileSize, App_Resume_FileName, App_Resume, App_Resume_FileType " & _        "FROM Mgmt_App_Resume_Table WHERE (Applicant_ID = @AppID)"        Me.cmdGetFile.Connection = Me.dbHRConn        Me.cmdGetFile.Parameters.Add(New System.Data.SqlClient.SqlParameter("@AppID", System.Data.SqlDbType.SmallInt, 2, "Applicant_ID"))        '        'dbHRConn        '        Me.dbHRConn.ConnectionString = "the connection string"
    End Sub
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load        Dim dr As System.Data.SqlClient.SqlDataReader        cmdGetFile.Parameters("@AppID").Value = Request("Applicant_ID")        dbHRConn.Open()        dr = cmdGetFile.ExecuteReader
        If dr.Read Then            Response.ContentType = dr("App_Resume_FileType").ToString            Response.OutputStream.Write(CType(dr("App_Resume"), _              Byte()), 0, CInt(dr("App_Resume_FileSize")))            Response.AddHeader("Content-Disposition", _              "attachment;filename=" + dr("App_Resume_FileName").ToString())        Else            Response.Write("File Not Found.")        End IfEnd Sub

View 5 Replies View Related

Reporting Services :: Error Showing Correct Month And Day

Nov 17, 2015

My laptop date format is mm/dd/yyyy.

In the report, I am using Format(field,"dd-MMM-yyyy"), but somehow the result comes out recognizing my month as day and my day as month. How do I fix this?

ie. my report date is 11/06/2015, the result shows 11-Jun-2015 instead of 06-Nov-2015.

View 2 Replies View Related

Error Handling Prevents Control Flow From Stopping. Is This Correct Behavior?

Dec 20, 2007



I have two tasks on a control flow. First task is Execute SQL task which drop an index. Second one is a Data Flow task. I also have an error handler for packcage_onerror. Because there is no index in the database, the first task rasies an error and package on error catches the error. The precedence constraint for the Data Flow task in "success". I don't expect the data flow task to execute because of the error. But it does. Is this the right behavior because I have already handle the error? I don't want the the job to continue if there is any error. I believe I should raise error in the error handler. Pleae help me how to do this. Thanks

View 12 Replies View Related

How To Troubleshoot/correct An Excel Destination - Opening A Rowset For &&<sheetname) Failed Error?

Apr 18, 2008

I have 2 Excel sheets ( Sheet1 and Summary) in an excel output file.
Sheet1 is created and loaded with data fine.
Summary sheet is getting the following error:
Error: 0xC0202009 at Write Counts and Percentages to Summary Sheet, Excel Destination [337]: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040E37.

Error: 0xC02020E8 at Write Counts and Percentages to Summary Sheet, Excel Destination [337]: Opening a rowset for "Summary" failed. Check that the object exists in the database.

I do have an execute SQL task to create the summary sheet before the data flow task.
The execute SQL task has
CREATE TABLE `Summary` (
`Counts_and_Percentages` LongText
)

Please advise on what I can do to troubleshoot/correct the error. Thanks

More details on the error
DTS.Pipeline] Error: "component "Excel Destination" (337)" failed validation and returned validation status "VS_ISBROKEN".
My Excel file name is an expression

@[User::FullFilePath] + (DT_STR, 4, 1252)DATEPART("yyyy", @[System::ContainerStartTime]) + "-" +
RIGHT("0" + (DT_STR, 2, 1252)DATEPART("mm", @[System::ContainerStartTime]), 2) + "-" +
RIGHT("0" + (DT_STR, 2, 1252)DATEPART("dd", @[System::ContainerStartTime]), 2) + " " +
RIGHT("0" + (DT_STR, 2, 1252)DATEPART("hh", @[System::ContainerStartTime]), 2) +
RIGHT("0" + (DT_STR, 2, 1252)DATEPART("mi", @[System::ContainerStartTime]), 2) +
RIGHT("0" + (DT_STR, 2, 1252)DATEPART("ss", @[System::ContainerStartTime]), 2) + " CLIENT=" +
@[User::ACCOUNT_NAME] + " output.xls"

View 4 Replies View Related

Correct Me????

Nov 22, 2005

I've created C#.net program (behind code style). 
when I run it in Internet explorer, the following error occurs in IE window.
pls instruct me how to handle and correct this error.
And how to initialize the connectionstring...  Great thank!
 
 
Server Error in '/' Application.
--------------------------------------------------------------------------------
The ConnectionString property has not been initialized. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: The ConnectionString property has not been initialized.
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.  
Stack Trace:
 [InvalidOperationException: The ConnectionString property has not been initialized.]   System.Data.SqlClient.SqlConnection.Open() +809   CodeBox.BehindCode.getSubject() +80   CodeBox.BehindCode.Page_Load(Object sender, EventArgs e) +31   System.Web.UI.Control.OnLoad(EventArgs e) +67   System.Web.UI.Control.LoadRecursive() +29   System.Web.UI.Page.ProcessRequestMain() +724 
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.0.3705.0; ASP.NET Version:1.0.3705.0

View 5 Replies View Related

Correct Use Of While

Oct 16, 2000

I have a simple while process to use with a trigger to insert values
into another table. IN VB this was simple but the while in TSQL seems
a little different. If anyone can point out my flaw greatly appreciated.

while @cnter < @nodays
--insert values
insert into table values (value1, value2)
--then increment counters and repeat
set @sdate = @sdate + 1
Set @cnter = @cnter + 1
How or what is the best way to loop back?

View 2 Replies View Related

What Is Correct ?

Mar 4, 2001

If you start receiving continuous error messages by e-mail indicating that the transaction log is full. After 2 days, the messages suddenly stopped. What could be the reason?

Windows NT App log is full or SQL Server Agent stopped

I think SQL Server Agent stopped
How do you think..and why ?

thanks

View 2 Replies View Related

What Is Correct ?!!!!^_^

Mar 5, 2001

If you start receiving continuous error messages by e-mail indicating that the transaction log is full. After 2 days, the messages suddenly stopped. What could be the reason?

Windows NT App log is full or SQL Server Agent stopped

I think SQL Server Agent stopped
How do you think..and why ?

thanks

View 1 Replies View Related

Is This Correct

Apr 24, 2008

Im new to SQL so please bear with me & help me as to why Im not getting the desired results.

I want to find the difference between two sets of tables that reside in different databases but contain the same data.
I ONLY WANT
a. records that are only in A but not in B
b. records that are only in B but not in A
______________________________________________________________________



Here is what I wrote using something that I found in this forum -

CREATE PROCEDURE RPT_DETAILS
AS
BEGIN
DECLARE @Rowcount AS INT
DECLARE @First_Name AS VARCHAR(50)
DECLARE @Last_Name AS VARCHAR(50)
DECLARE @Id AS INT

CREATE TABLE #Prowess(ID INT NOT NULL, First_Name VARCHAR(50), Last_Name VARCHAR(50))
CREATE TABLE #SDK(ID INT NOT NULL, First_Name VARCHAR(50), Last_Name VARCHAR(50))

INSERT INTO #Prowess
SELECT bb.beenumber, be.FirstName, be.LastName FROM beebusiness bb
join beeentity be on bb.beebusinessguid = bb.beebusinessguid


INSERT INTO #SDK
SELECT cast(sa_ss as INT), first_name, last_name from ml


SELECT @ROWCOUNT = MAX(ID) FROM #SDK
PRINT '------------------------------------------------------------------------------------------'
PRINT '------------------------COMPARISION REPORT Between Prowess & SDK--------------------------'
PRINT '------------------------------------------------------------------------------------------'

PRINT 'TOTAL Difference ('+ +
CAST(@ROWCOUNT AS VARCHAR(50))

WHILE @ROWCOUNT > 0
BEGIN
SELECT @First_Name = First_name, @Last_Name = Last_name, @ID = ID
FROM #Prowess WHERE ID = @ROWCOUNT
PRINT ' * '+@First_Name+@Last_Name
SET @ROWCOUNT = @ROWCOUNT - 1
END


SELECT @ROWCOUNT = MAX(ID) FROM #Sdk

PRINT 'TOTAL Difference ('+ + CAST(@ROWCOUNT AS VARCHAR(50))

WHILE @ROWCOUNT > 0
BEGIN
SELECT @First_Name = First_name, @Last_Name = Last_name, @ID = ID
FROM #Sdk WHERE ID = @ROWCOUNT
PRINT ' * '+@First_Name+@Last_Name
SET @ROWCOUNT = @ROWCOUNT - 1
END

DROP TABLE #Prowess
DROP TABLE #Sdk

END

View 5 Replies View Related

Plz Correct This

May 5, 2008

declare @var varchar(50)
set @var= 'COLUMNNAME'
select ID, a.@var , b.@var
from rooper a
join jim_rooper b on b.id = a.id
join b_rooper bb on bb.id = a.id
where a.@var != b.@var


All that Im trying to do here is instead of using a columnname, Im trying to substitute it with a variable so that it can be referenced at multiple places...

View 4 Replies View Related

T-SQL Correct Or Not???

May 28, 2008

Hi

I am writing T-SQL pls tell me wheather it is correct syntax or not

DECLARE @Chg1 VARCHAR(500)
SET @Chg1 = 'declare @AntID numeric exec casp_Switch_BackupData @AntID = #ANTID#'
SET @Chg1 = REPLACE(@Chg1,'#ANTID#','@AntID')
EXEC (@Chg1)

As I am getting following output
Command(s) completed successfully.

T.I.A

View 6 Replies View Related

Is It Correct?

Jun 2, 2008

hi!

i want to use IN query like

select ... from ...
where field1 in (...)
and field2 in (....)

when i write query like this, the result is display.
but its wrong.
is it correct?

View 3 Replies View Related

Is This Correct?

Aug 29, 2005

Dim strsql As String

strsql = "insert into MYENTRY(entryid) "
strsql &= "VALUES ("
strsql &= "'" & strtheEntryid & ")' "

I am not sure if this is correct snytax?

View 3 Replies View Related

Is This Correct?

Jun 28, 2006

hi

if row.col1 = nothing then ...

instead of (sql2k) if dtssource("col1") = null then...

TIA

View 3 Replies View Related

Is CLR Is Correct Way To Do It...

Jan 1, 2008

Hello to all,

Is it correct way to register my CLR library instead of having T-SQL codes (eg, Strored Procedure, Functions and Triggers) in the database in the following case:

Code security: If my Application (in .NET 2.0) and SQL Server Express in same PC and I have to give Windows-Administrator password to my application-user (to install/unistall some other softwares)

Thanks

PSDCHD

View 1 Replies View Related

Correct Syntax

Sep 25, 2006

HelloI have having trouble displaying some simple columns in ascending order.I know that the database is populated and I can get the more complex code to work if I display like this: SELECT FName, LName, Town, '<a href="' + url + '">' + Site + '</a>' as LinkFROM Names_DBWHERE FName = 'Tom' And url like 'http:%'ORDER BY LName ASCBut I need a simpler view but I can't get it to workI  have tried this:SELECT FName, LNameFROM Names_DBORDER BY  LName ASCAnd thisSELECT FName, LNameFROM Names_DBORDER BY  LName ASC; And This:SELECT FName, LNameFROM Names_DBORDER BY  LName 'ASC' What is wrong with this syntax?ThanksLynn

View 2 Replies View Related

Not Getting The Correct Count

May 12, 2008

I'm trying to get a year count and a year amount of payments made by a client. Below is my statement, it is not giving a correct count. If a client made more than one payment on the same day it counts it as 1.
What can I do to this statement to get correct totals?
SELECT DISTINCT                       Client_ID, DATEPART(year,PaymentDate) AS 'Year', SUM(AmountPaid) AS 'TotalYearlyPayments', COUNT(DISTINCT Payment_ID) AS 'YearlyPaymentCount'FROM        tblPaymentsWHERE Client_ID = @ClientIDGROUP BY Client_ID, DATEPART(year, PaymentDate)ORDER BY Client_ID, Year 

View 1 Replies View Related

SQL Injection - Is This Correct

Jun 5, 2006

Hi, I'm building a web application in which I want to prevent SQL injection. I'm using stored procedures, and using queries on my app like this:in my database...create proc createStudy@title varchar(200),@text textasinsert into studies values(@title,@text)goand in my web app...query="createStudy '"+titleBox.Text+"','"+textBox.Text+"'";   //title and text boxes are textboxes, createStudy is a stored procedure in my databaseodmccommand cmd = new odbccommand(query,con);con.Open();cmd.ExecuteNonQuery();But before this I do this code:if (titleBox.Text.Contains("Drop") || titleBox.Text.Contains("Delete"))    messageLabel.Text="No permissions to do that";else(...my code)Is this ok to prevent SQL injection?!?

View 5 Replies View Related

Not Getting All The Values Correct

Aug 13, 2004

Hi,

This is strange....

I am getting my source data from another system am storing the SaleAmount of each product in a field the data type of which is [decimal](12, 2).

For some products I am getting an exact match (upto 2 decimal places) as compared with my source data BUT for some other products the value before the decimal places is correct but the 2 digits after the decimal place does not match with the source data :confused:

Even if this sounds stupid, can you please guide me. Am i missing some very basic and common sense thing?

Many TIA.

View 2 Replies View Related

What Is The Correct Syntax For Anything

Mar 15, 2007

I have a query and I need to check to see if a field is occupied, i.e., it can have anything in it, i just want to see if something is there... this is what I want, but of course, anything isn't the right word here...

and (r.id = 'anything')

View 7 Replies View Related

I Know I'm Stupid .. Please Help Me Correct Me.

Apr 13, 2008

I have two tables:
1) Table that holds all available ports.
2) Table that holds users for each port.

There may be times where one user is getting more than one port at a time.

I've built up an ASP .NET page that will display each user its port/s in one table.
On another table I want to display all the other available ports which the user doesn't posses and can buy to own.

My problem is where I try to build up the query. I just can't get all the other ports in normal display.



For example, this is what I need:

Ports table:
1/1
1/2
1/3
1/4

Users table:
User A , 1/1
User A , 1/2

ASP page display:

------------
User A Holds:
1/1
1/2
------------

Available:
1/3
1/4
------------


Of course the Available option is derived from the User Holds query, and just getting the opposit not equal ports, but I just can't get it !
I've tried all kinds of Joins and nesting SELECT queries with no luck.

I hate SQL. I want to die.

View 4 Replies View Related

Match The Correct Value

Apr 25, 2008

I have this sql statement:

SELECT Countries.Name, Companies.ShortName, Persons.FirstName, Persons.LastName, PersonSkills.Skills
FROM PersonSkills INNER JOIN....

How can I choose a certain value from PersonSkills.Skills?

for example, I would like to choose a value from PersonSkills.Skills that matches a certain product. I can do the Max/Min value but the selected value needs to match the product.

The tables that I have are:
PersonSkills:
id, ProductID, Skills

Product:
id, ProductName

Ive been reading and playing around with this without success.

View 6 Replies View Related

Please Correct This Procedure

May 23, 2008

create proc AuthorTable @AuthotID int,
@AuthorName varchar(20),
@AuthorBook varchar(60),

as
insert into dbo.Author
( AuthorID,
AuthorName,
AuthorBook

)
values
( @AuthotID ,
@AuthorName,
@AuthorBook
)


spatle

View 2 Replies View Related

Correct Count

Oct 16, 2006

Hello Everyone,

I have the following code:


USE CHEC
SELECT
[DATE_CONVERSION_TABLE_NEW].MONTH,
DAY([DATE_CONVERSION_TABLE_NEW].[DISBURSEMENT DATE]) AS DayofMonth,
DAT01.[_@550] AS LoanType,
DAT01.[_@051] AS Branch,
DAT01.[_@TP] AS ProdTypeDescr,
SMT_Branches.[BranchTranType] AS TranType,
--SMT_Branches.[AUCode] AS AuCode,
Count(*) AS Totals
FROM DAT01 INNER JOIN [DATE_CONVERSION_TABLE_NEW]
--ON DAT01.[_@040] = [DATE_CONVERSION_TABLE_NEW].[DISBURSEMENT DATE]
ON DAT01.[_@040] = [_@040]
INNER JOIN SMT_BRANCHES
ON SMT_Branches.[BranchTranType] = SMT_BRANCHES.[BranchTranType]
WHERE
DAT01.[_@040] Between '06/01/2006' And '06/30/2006'
And SMT_BRANCHES.[BranchTranType] = 'RETAIL'
AND DAT01.[_@051] = '540'
--And SMT_Branches.[AUCode] = '1882'
And DAT01.[_@TP] = '115'
And DAT01.[_@550] = '3'
GROUP BY
DAT01.[_@051],
DAT01.[_@550],
DAT01.[_@TP],
SMT_Branches.[BranchTranType],
SMT_Branches.[AUCode],
[DATE_CONVERSION_TABLE_NEW].MONTH,
DAY([DATE_CONVERSION_TABLE_NEW].[DISBURSEMENT DATE])
ORDER BY [DATE_CONVERSION_TABLE_NEW].MONTH, DAT01.[_@051],
DayofMonth ASC,
SMT_Branches.[AUCode] ASC
--COMPUTE sum(count(*))


Here is a partial display of the results:

APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39
APRIL13540115RETAIL39

The count is the same everytime. It should be different. What am I doing wrong?

TIA and have a great day!

Kurt

View 20 Replies View Related

Please Correct My Query

Sep 29, 2007

DECLARE @fullname nvarchar(50)
SET @fullname =
(SELECT (OriginalName + ContentType) AS Name
FROM Files_Dyn)
INSERT
INTO Files_Dyn(FullName)
VALUES (@fullname) where username = 'user_admin'
...what is the wrong with this query..it is giving 'Incorrect syntax near the keyword 'where'. Please correct me!
thanks in advance!

View 10 Replies View Related

Correct Syntax

Feb 25, 2008

Hi.

This is a Stored proc I am working on
I dont know much about stored procs.
This is what I am trying to achieve
The proc takes two input parameter and returns one outparameter.

This is what I have

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[GetNextAction]

(
@Code char(10),
@Track varchar(30),
@NextAction ntext output
)
AS
BEGIN

SET NOCOUNT ON;
Declare @ID int;
@ID = Select Sequence from [dbo].[Track] where Code=@Code;
Declare @nextCode varchar;
@nextCode= Select Code from [dbo].[Track] where sequence =(@ID+1);
@NextAction= Select nextAction from [dbo].[CaseStage] where Code=@nextCode;
return @NextAction;


END
GO

I guess you can understand what I am trying in the proc but the rules and syntax are wrong. Please help me with this.
Thanks

View 4 Replies View Related

But The Documentation Is NOT Correct

Jul 23, 2005

The documentation saysISNUMERIC returns 1 when the input expression evaluates to a validinteger, floating point number, money or decimal type; otherwise itreturns 0. A return value of 1 guarantees that expression can beconverted to one of these numeric types.(Cut and pasted from books online)Yet the following, one of many, example shows this is not true.select isnumeric(char(9))select convert(int, char(9))-----------1(1 row(s) affected)Server: Msg 245, Level 16, State 1, Line 2Syntax error converting the varchar value '' to a column of data typeint.So, besides filtering every possible invalid character, how do youconvert dirty values without error. I am not concerned that I may loosepossibly valid values or convert suspect strings to 0 (zero). I justwant to run without raising an error

View 3 Replies View Related







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