Problem With Date Reformatting Upon Assigning To A Variable

Apr 3, 2008

Hi all!!!


I have a smalldatetime field in a table that holds dates as 3/1/2008. If you run a select query on the field it will bring back the date as a datetime vairable. I reran the query using the following:
select convert(varchar,cast((max(ENTRY_DTE))as datetime),101)
This query brings me back the date as 03/01/2008.

When I utilize the same query and set the value to a declared variable, defined as datetime, it brings me back the date as : Mar 01 2008 12:00AM

I have tried several different ways to convert the date however as soon as appoint it to a declared variable I receive the same result!!

PLEASE HELP!!

View 4 Replies


ADVERTISEMENT

Reformatting DATE

Jul 20, 2005

I currently have a date column that draws from the now() function in myasp script. The date looks like this:2/5/2004 10:09:52 AMAs you can see, there is the day and the time data all in the samestring.What I would like to do is run a group by clause that groupsall the dates that are on the same day togeather. But how do I seperatethis data in SQL? I know there are VB functions that can do this, but inorder for the group function to work when running a sql statement, Ihave to do it in SQL itself. Does anyone know how this is done?Thank you!Bill*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!

View 1 Replies View Related

T-SQL: Reformatting Date From US To European

Apr 16, 2008

Is anyone familiar with a system function (or UDF) that will take a date string and convert it from US (mm/dd/yyyy) to European (dd/mm/yyyy) format?

View 2 Replies View Related

Assigning A DB Value To A Variable

Mar 8, 2005

Consider the following:

Sub regUser(s as Object, e as EventArgs)

If IsValid Then

Dim stuTable as String
Dim connStr as String

stuTable = "mytable"
connStr = "myConnectionInfo"

'check to see that student num is in the db
Dim connect as SqlConnection
Dim strSelect as String
Dim cmdSelect as SqlCommand
Dim strDbResult as SqlDataReader

connect = New SqlConnection(connStr)
strSelect = "SELECT stu_num, stu_fname, stu_lname FROM " + stuTable + " WHERE stu_num=@stuNum"
cmdSelect = New SqlCommand(strSelect,connect)
cmdSelect.Parameters.Add("@stuNum", txtStdNum.text)

connect.Open()
strDbResult = cmdSelect.ExecuteReader()

Dim stuFName as String
Dim stuLName as String
Dim stuEmail as String
Dim strRandom as String
Dim strPassword as String
Dim i as Integer
Dim charIndex as String
Dim stuMailMessage as MailMessage
Dim strHTMLBody as String

'declare stuFname, stuLname, stuEmail
stuFName = strDbResult("stu_fname")
stuLName = strDbResult("stu_lname")
stuEmail = txtStdEmail.text

'more code follows ....

In my DB I have a table with the columns stu_num, stu_fname and stu_lname. Each of these columns contains rows with data. However, the proceeding code gives me this error: Invalid attempt to read when no data is present (line 58 --> stuFName = strDbResult("stu_fname") ).

What am I doing wrong here? How do I assign the stu_fname in the DB to the page level variable stuFName?

As a little aside how do I say "If no record was found matching stuNum Then" ... ??

Sorry, I'm a .NET beginner ...

View 1 Replies View Related

Assigning Value To A Variable

Feb 4, 2008

Hi,
Is it possible to assign the column value to a user defined variable?

View 3 Replies View Related

Assigning Value To An Variable

Aug 24, 2007



Hi ,

I have a typical scenario here where I am trying to assign a variable a value using another variable, for that I am using two execute SQL task , the fisrt one assigns the first variable a value and then the second one uses the first variable to evaluate and then assigns a value to another variable. The first execute sql task works fine , however the second one fails with the following error

"failed with the following error: "An error occurred while extracting the result into a variable of type (DBTYPE_I4)". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly. "

Here is the query I am using to assign the value in my second execute sql task


select (CASE

WHEN Sum(col1) <> 0 AND ? = 'M' THEN 'M'

WHEN Sum(col2) <> 0 AND ? >= 'T' THEN 'T'

WHEN Sum(col3) <> 0 AND ? >= 'R' THEN 'R'

ELSE 'S'

END) as Current

FROM dbo.TABLE1


I am passing the variable by mapping the parameters and then assigning the value using a single row result set.
Can someone please tell me where am I going wrong?

Thanks

View 13 Replies View Related

Error With Assigning Variable A Value

Dec 6, 2006

i am trying on this but hit error

Declare @var int
Set @var = select max(value) from xxx

anyone can help me?

View 2 Replies View Related

Assigning A Variable A Table Value

Aug 8, 2006

Hi I'm new to SQL and I'm trying to build a store procedure. What I'm trying to find out is how to assign a variable a value from a table.

So, I declare a variable:
DECLARE @variable int
Then I want to assign a single int value to that variable that is already in a table. For instance the id value from a single row in a table.

I've tried SELECT INTO and SET, but nothing has worked so far and I'm lost after searching for a few hours.

Thanks in advance for any help

View 3 Replies View Related

Assigning Value Of A Variable To A Column Name

Mar 25, 2008



Hi,

I would like to assign the value of a variable to a column name of a table. For eg:

declare @sam varchar(100)
set @sam = 'Insert'
create table #temp(Sample varchar(100) not null)
insert into #temp(Sample) Values(@sam)
drop table #temp

I would like to generate a table whose column name should be generated dynamically. The value of @sam that is "Insert "should be set to the column name. Is there a way to assign like this. Can anyone please help me in achieving this.

Thanks,
Sana.

View 1 Replies View Related

Assigning Value To The Variable At Runtime.

Mar 20, 2008

Hi,

1 20031012121212 200 (recordtype, CreationDateTime(YYYYMMDDHHMISS), Rec_Count) -- Header records
2 ABCD, XYZ, 9999, 999999999, 1234 ---- Detailed Record
2 ABCD, XYZ, 9999, 999999999, 1234 ---- Detailed Record

For the above given sample data I am having two outputs at Condition Split (based on the recordtype). I want to store the 1st record datetime value into a variable and then I want to use that variable value into 2nd and 3rd row.

Basically, detailed records would be stored into the database not the header record. Is there any way I can use the variable while doing processing for 2nd and 3rd records.

Please suggest me.

Regards,

View 10 Replies View Related

Assigning Data From An SQL Query To A Variable

Apr 27, 2006

Hello all,
for a project I am trying to implement PayPal processing for orders
public void CheckOut(Object s, EventArgs e)    {        String cartBusiness = "0413086@chester.ac.uk";        String cartProduct;        int cartQuantity = 1;        Decimal cartCost;        int itemNumber = 1;        SqlConnection objConn3;        SqlCommand objCmd3;        SqlDataReader objRdr3;        objConn3 = new SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);        objCmd3 = new SqlCommand("SELECT * FROM catalogue WHERE ID=" + Request.QueryString["id"], objConn3);        objConn3.Open();        objRdr3 = objCmd3.ExecuteReader();        cartProduct = "Cheese";        cartCost = 1;        objRdr3.Close();        objConn3.Close();                cartBusiness = Server.UrlEncode(cartBusiness);        String strPayPal = "https://www.paypal.com/cgi-bin/webscr?cmd=_cart&upload=1&business=" + cartBusiness;        strPayPal += "&item_name_" + itemNumber + "=" + cartProduct;        strPayPal += "&item_number_" + itemNumber + "=" + cartQuantity;        strPayPal += "&amount_" + itemNumber + "=" + Decimal.Round(cartCost);        Response.Redirect(strPayPal); 
 
Here is my current code. I have manually selected cartProduct = "Cheese" and cartCost = 1, however I would like these variables to be site by data from the query.
So I want cartProduct = Title and cartCost = Price from the SQL query.
How do I do this?
 
Thanks
 

View 1 Replies View Related

In Sql Server 2000, Assigning Count() To Variable

Oct 25, 2004

Hello all, I'm creating a stored procedure in SQL Server 2000. I'm trying to count how many rows match a certain WHERE clause, and assigning this integer to a variable:

----------------
DECLARE @RowCount int,

SELECT COUNT(*) FROM Customers WHERE FirstName='Joe'
----------------

How can I assign the count that returns from the SELECT statement to the @RowCount?

Thanks

View 2 Replies View Related

Assigning Variable Values Via Loop Using Different Datatypes

Apr 10, 2008

Hi all,

I need some help regarding a conversion in a Script Task.

I am reading my variable values from a database with a sql task, the table has two columns, variable and variableValue.
Looping through the recordset and setting the different variables works well, with two links:
http://blogs.conchango.com/jamiethomson/archive/2005/02/09/SSIS_3A00_-Writing-to-a-variable-from-a-script-task.aspx
http://sqlblog.com/blogs/andy_leonard/archive/2007/10/14/ssis-design-pattern-read-a-dataset-from-variable-in-a-script-task.aspx

setting the variable value only works well if the package variable is defined as string, because the db field is a varchar, trying to assign an integer for example brings up an error.

Therefor I tried something like CType:
Dts.Variables("MyVar").Value = CType(MyRecordsetField,String), where the target datatype should be depending on the variable datatype instead of being assigned as a constant.

Could someone give me a hint to handle this?

Thanks in advice!

Cheers
Markus

View 3 Replies View Related

Assigning Datepart Function To A Datetime Variable?

Aug 12, 2006

I am getting wrong output when assigning a datepart function to a variable. I should get 2006 but instead I get an output 1905.

Below is the code and output. Any help will be greatly appreciated. Thanks



DECLARE @FiscalStartCurrYear datetime

SET @FiscalStartCurrentYear = DATEPART(year, GETDATE())

select @FiscalStartCurrYear



Output

-----------

1905-06-30 00:00:00.0000

View 5 Replies View Related

No Luck W/ Execute Sql Task And Assigning Variable

Jan 31, 2007

Hello,

I've asked this question before and I've read the answers before and I still cannot get it to work. My task is simple, I want to use the execute sql task container to grab a value from a database and put it in a variable. I've done all the preliminary stuff such as running profiler to make sure that the package is getting the call to the database, setting up the ResultSet to be "single row" in the general tab, mapped the Result Set correctly, but nothing works. I get the same error every time.

This is my sql command:

select output_location as output_location
from script_master

Result Set is set up like this:

Result Name: output_location ; Variable Name: User::output_location



Here is the error I get:

Error: 0xC002F309 at Execute SQL Task, Execute SQL Task: An error occurred while assigning a value to variable "output_location": "The type of the value being assigned to variable "User::output_location" differs from the current variable type. Variables may not change type during execution. Variable types are strict, except for variables of type Object.

".

I don't know what I'm doing wrong, I've followed all the instructions exactly on how to populate a variable in this container. My variable is set up as a string, if I change it to object I can get it to work. I think this is because the object is allowing nulls. I really believe that the variable is not populating and that is why I'm getting errors.



Please help. If you could provide step by step example's that would really make my day.



Thanks,

Phil



View 15 Replies View Related

Urgent Help: Regarding Assigning Mulitple Rows Of A Given Column To Variable

Aug 13, 2007

How to assign multiple values to emp1 variable separated by comma
 Ex: If  ajay karthik vijay are employee names in emp table
then emp1= ajay,karthik, vijay 
set emp1= (select employeename   from emp) returns error
error: subquery returns morethan one value
 
 
 

View 4 Replies View Related

Xml Value Method Randomly Returns Null When Assigning To A Variable

Apr 20, 2007

I'm using SSEE 9.0.3042 and started loosing sleep over trying to figure out why the following piece of SQL



DECLARE @x xml

DECLARE @a nvarchar(400);

DECLARE @b nvarchar(400);

DECLARE @c nvarchar(400);

SET @x=N'<SuchKriterienDataSet xmlns="http://tempuri.org/SuchKriterienDataSet.xsd">

<SuchKriterien><Index>0</Index><Name>a</Name><Wert>Test1</Wert><Bedingung>0</Bedingung></SuchKriterien>

<SuchKriterien><Index>1</Index><Name>b</Name><Wert>Test2</Wert><Bedingung>0</Bedingung></SuchKriterien>

<SuchKriterien><Index>2</Index><Name>c</Name><Wert>Test3</Wert><Bedingung>0</Bedingung></SuchKriterien>

</SuchKriterienDataSet>';

WITH XMLNAMESPACES ('http://tempuri.org/SuchKriterienDataSet.xsd' AS ds)

SELECT

@a=@x.value('(/dsuchKriterienDataSet/dsuchKriterien/ds:Wert[../ds:Name = "a"])[1]','nvarchar(400)'),

@b=@x.value('(/dsuchkriterienDataSet/dsuchkriterien/ds:Wert[../ds:Name = "b"])[1]','nvarchar(400)'),

@c=@x.value('(/dsuchKriterienDataSet/dsuchKriterien/ds:Wert[../ds:Name = "c"])[1]','nvarchar(400)');

WITH XMLNAMESPACES ('http://tempuri.org/SuchKriterienDataSet.xsd' AS ds)

SELECT

@x.value('(/dsuchKriterienDataSet/dsuchKriterien/ds:Wert[../ds:Name = "a"])[1]','nvarchar(400)'),

@x.value('(/dsuchKriterienDataSet/dsuchKriterien/ds:Wert[../ds:Name = "b"])[1]','nvarchar(400)'),

@x.value('(/dsuchKriterienDataSet/dsuchKriterien/ds:Wert[../ds:Name = "c"])[1]','nvarchar(400)')

UNION ALL

SELECT @a,@b,@c



returns



Test1 Test2 Test3

Test1 NULL Test3



instead of



Test1 Test2 Test3

Test1 Test2 Test3



This is the shortest repro I could assemble. Once you increase the number of variables, a random pattern of dropped values emerges.



I could repro on fully patched Windows XP German w/ SSEE ENU and Windows Server 2003 64-bit w/ SSEE GER.



Any workaround highly appreciated.

Thx,

Henry

View 5 Replies View Related

Assigning A Particular Flat File Record To A String Variable

Jun 12, 2007

Hey all!

Okay, can I assign line x of a flat file to a variable, parse that line, do my data transformations, and then move on to line x+1?

Any thoughts?

In other words, I'm looking at using a for loop to cycle through a flat file. I have the for loop set up, and the counter's iterating correctly. How do I point at a particular line in a flat file?

Thanks for any suggestions!

Jim Work

View 5 Replies View Related

How To Get Query Second Column Value/other Rows While Assigning To A Variable In A Stored Procedure?

Feb 6, 2008

Hi,
I'm try to get the query second column value when it is assinged to a varchar variable.
Ex:In SP below is statement I wrote
SET @Values  =  (SELECT COL1,COL2 FROM TABLE)
Question 1:  How to access the COL2 value from @Value2?
Question 2:  How to access the other row values if above returns more than a row?
Please send me the solution as soon as possible.
Thanks-Vikash/Bala

View 3 Replies View Related

Integration Services :: Assigning Package Variable In Script Component

Oct 15, 2015

In my SSIS package I am looping multiple flat file to load data into target table. I have used one variable to get that filename. I have error log table which used to log the invalid record which come from various files.

All are working fine , except I want to log the filename also in my error log table. How can we use the package variable to assign the variable value in script component.so that I can map the output column to target table. I have created Filename column in script component in output column tab.

View 2 Replies View Related

SQL Server 2012 :: Assigning Multiple Rows To A Single Variable Parameter

Nov 27, 2014

The following works in query if I specify one student (PlanDetailUID) when running query. If I try to specify multiple students (PlanDetailUID) when running query, I get variable cannot take multiple entries. I assume I would need to replace (variables) in PART 2 with (case statements / using select everywhere) to get around the issue or is there a better way ?

CREATE TABLE #AWP (
[TransDate] [datetime] NULL,
[Description] [varchar](1000) NULL,
[Amount] [float] NULL,
[TotalDueNow] [float] NULL,

[code]....

View 4 Replies View Related

Problem Assigning Value To Package Variable From Data Flow Script Component

Sep 28, 2005

In my Script Component properties I have included "ClientReportGroupId" as a ReadWrite variable. This variable is declared as a Package Variable.

View 23 Replies View Related

The Return Of Problem Assigning Value To Package Variable From Data Flow Script Component

Jul 10, 2006

I have a Data Flow Script Component(Destination Type) and in the properties I have a read/write variable called User::giRowCount

User::giRowCount is populated by a Row Count Component previously in the Data Flow.


After reading http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=97494&SiteID=1 it is very clear that you can actually only use  variables in the PostExecute of a Data Flow Script Component or you will get an error
"Microsoft.SqlServer.Dts.Pipeline.ReadWriteVariablesNotAvailableException: The collection of variables locked for read and write access is not available outside of PostExecute."




What I need to do is actually create a file in the PreExecute and write the number of records = User::giRowCount as second line as part of the header, I also need to parse a read/write variable such as gsFilename to save me hardcoding the path

(Me.Variables.gsFilename.ToString),(Me.Variables.giRowCount.ToString)

 -they must go in the PreExecute sub --workarounds please-here is the complete script component  that creates a file with header, data and trailer --Is there any workaround

Thanks in advance Dave
 
Imports System
Imports System.Data
Imports System.Math
Imports System.IO
Imports System.Text
Imports System.Configuration
Imports Microsoft.SqlServer.Dts.Pipeline.Wrapper
Imports Microsoft.SqlServer.Dts.Runtime.Wrapper
 
Public Class ScriptMain
    Inherits UserComponent
    'Dim fs As FileStream
    Dim fileName As String = "F:FilePickUpMyfilename.csv"
    'Dim fileName = (Me.Variables.gsFilename.ToString)
 
    Dim myFile As FileInfo = New FileInfo(fileName)
    Dim sw As StreamWriter = myFile.CreateText
    Dim sbRecord As StringBuilder = New StringBuilder
 
 
    Public Overrides Sub PreExecute()
 
        sbRecord.Append("RECORD_START").Append(vbNewLine)
 
    End Sub
 
 
 
    Public Overrides Sub ParsedInput_ProcessInputRow(ByVal Row As ParsedInputBuffer)
 
        sbRecord.Append(Row.ProjectID.ToString)
        sbRecord.Append(Row.TransactionRefNum.ToString)
        sbRecord.Append(Row.BillToCustomerNum.ToString)
        sbRecord.Append(Row.BillToAccountNum.ToString)
        sbRecord.Append(Row.BillToLineNum.ToString)
        sbRecord.Append(Row.BillToReassignmentNum.ToString)
        sbRecord.Append(Row.ChargeCode.ToString)
        sbRecord.Append(Row.NotificationMethod.ToString)
        sbRecord.Append(Row.AdjustmentAmount.ToString)
        sbRecord.Append(Row.AdjustmentDate.ToString)
        sbRecord.Append(Row.ReparationGivenFlag)
        sbRecord.Append(Row.BillingSystemProcessingErrorCode.ToString).Append(vbNewLine)
       
    End Sub
 
    Public Overrides Sub PostExecute()
        sbRecord.Append("RECORD_COUNT").Append((vbTab))
        sbRecord.Append(Me.Variables.giRowCount.ToString).Append(vbNewLine)
      sbRecord.Append("RECORD_END").Append(vbNewLine)
       'Now write to file before next record extract
        sw.Write(sbRecord.ToString)
        'Clear contents of String Builder
        sbRecord.Remove(0, sbRecord.Length)
 
 
       'Close file
        sw.Close()
 
    End Sub
 
 
End Class

Has anyone got a workaround

thanks in advance

Dave

View 6 Replies View Related

Assigning Current Date To A DTS Parameter

Oct 28, 2007



How do I assign the current date to a DTS parameter using a script - the following fails:


Imports System

Imports System.Data

Imports System.Math

Imports Microsoft.VisualBasic

Imports Microsoft.SqlServer.Dts.Runtime

Public Class ScriptMain

Public Sub Main()

Dts.Variables("RunDate").Value = Now.Date

Dts.TaskResult = Dts.Results.Success

End Sub

End Class

Error message:

Error: The wrapper was unable to set the value of the variable specified in the ExecutionValueVariable property.

Thanks.

Dan

View 3 Replies View Related

Problem Assigning SQL Task Result To A Variable - Select Count(*) Result From Oracle Connection

Dec 26, 2007



I have an Execute SQL Task that executes "select count(*) as Row_Count from xyztable" from an Oracle Server. I'm trying to assign the result to a variable. However when I try to execute I get an error:
[Execute SQL Task] Error: An error occurred while assigning a value to variable "RowCount": "Unsupported data type on result set binding Row_Count.".

Which data type should I use for the variable, RowCount? I've tried Int16, Int32, Int64.

Thanks!

View 5 Replies View Related

[Execute SQL Task] Error: An Error Occurred While Assigning A Value To Variable

Jun 20, 2007

hello
I have a problem with Sql task
when sql task tried to assing a value to my variable I have this error ""La valeur n'est pas comprise dans la plage attendue."
I'm using ODBC connexion for a csv file

someone can help me ?

thanks

View 4 Replies View Related

[Execute SQL Task] Error: An Error Occurred While Assigning A Value To Variable...

Nov 8, 2006

hi chaps

i m getting the following ERROR:

[Execute SQL Task] Error: An error occurred while assigning a value to variable "JDETimezone": "Unable to find column Timezone in the result set.".



i know what the problem is i.e. no row is returned then what is the problem

here you are.... i want to it work... strange... ok i explain...

actully i have some processign to do with variable JDETimezone even no row is returned.... can u tell me the alternative to do the follwing task...

I want to retrieve a record from some table and do some processing and if no row is present or returned then i want to do seperate processing.... can ne one help me out ?



regards,

Anas

View 4 Replies View Related

Reformatting Output From A Query

Jul 26, 2004

Hey everyone,

as of now i have a sql chunk


Code:


SELECT VIEW.DWG_NAME
FROM VIEW, qry_TURNOVER
WHERE (((VIEW.ID)=[qry_TURNOVER].[CURRENT_ID]));



which works but when i get the results it orders them according to number ( or what seems to be in the order of ID), and i need it in the order that it appears in the column CURRENT_ID

If that is not clear This is what is happening

For example, we have:

qry_TURNOVER
CURRENT_ID
4
5
1
3

VIEW
ID DWG_NAME
1 23g
2 24H
3 25J
4 26K
5 27L

As it stands,The results auto format to:

23G
25H
26K
27L

I need the results to be:

26k
27L
23G
25J


Hope that was clear, any ideas? Im not sure if this is even possible. Any hints or tips to a solution would be much appreciated. The reason why current ID is unordered is because its has other data in its table that is ordered via that way. So current ID cannot be orderd to match out out, it must be the other way around.

Thanks
Doc

View 3 Replies View Related

Reformatting Field Results

Jul 24, 2006

Hi

I am trying to make a query from a sql server 2000 database i have a table as follows:

Operatinngsystem FQDomain
============= ========
Windows server1.gnet.net
Windows server2.gnet.net
Windows server3.gnet.net

what i want to be able to do is to return the result so that the server1-3 asre in a seperate colunm and the gnet.net seperate i want the out put as follows:

Operatinngsystem Server Domain
============= ====== ======
Windows server1 gnet.net
Windows server2 gnet.net
Windows server3 gnet.net

therefore three colunms output. I would be greatful if any one got any ideas how i can do this? (Please note im new to sql server)

Thanks

abuhassan

View 15 Replies View Related

How To Match The Date Variable And Character Variable

Oct 9, 2001

Hello,
I run the DTS to copy data from Progress to SQL Server. How can match/convert the date variables to check.
The field p-date as format 'mm-dd-year' . It has the value of 10/09/2001.
The field s-date as varchar format. It has the value 2001-10-09.
How can use the where condition ( Select ...... WHERE p-date = s-date.)

Thanks

View 1 Replies View Related

SQL Server 2012 :: Loading And Reformatting Text File Data Into Table

May 29, 2015

I am looking for a way to convert the following format into a sql table. The format it is Bib Tex.

Essentially a new row in the table would be for each entry, denoted by an @ logo and each column is denoted by an =, as you can see from the example data no one contains all the possible columns and some fields can be over two lines long.

To load this I was considering loading it into a table as each line being a row. Adding a row number, then a column counting the @ signs in order and essentially grouping each record, then for each group running through and looking for the column keywords 'author' , 'title' etc then splitting the data out into those constituent parts using substring and charindex.

@Book{hicks2001,
author = "von Hicks, III, Michael",
title = "Design of a Carbon Fiber Composite Grid Structure for the GLAST
Spacecraft Using a Novel Manufacturing Technique",
publisher = "Stanford Press",
year = 2001,

[Code] ....

View 9 Replies View Related

Select Problem With Date Variable

Jan 8, 2001

I'm still having a problem getting a select statement to work. I have posted the script on a web site, along with the table definitions, and sample output at the bottom. The problem is when I set @total_debits, I get 0 instead of 11580.95. I think the problem is that the format of the @end_date or the @balance_date is the problem. Please take a look at it. I posted a question on Friday about this, and tried to give a "snippet" and mistyped it. So here it is. Please give me all feed back.

Script at http://www.pschallenge.com/sql_problem.html

Thanks,

Brian

View 1 Replies View Related

Running Date Variable On One Field

Sep 19, 2014

I have two tables that I am pulling data from: an item table and a sales table. Almost all of the information comes from the item table (item description, location, amount on hand). The last field wanted is Year-To-Date sales. I can pull the sales field from the sales table, which gives me all sales from the creation of the db. I need to be able to run a date variable of This Year on that sales field only. I have a date field I can reference off of in the sales table.

View 6 Replies View Related







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