Using Comparison Operators In Query Expression

Sep 14, 2006

I'm trying to put an expression into a view query column. I've already created a column which contains the results of a calculation in the form of an expression. What I don't know how to do is use comparison operators to return a boolean value for display. I'll give some examples of what I'm trying to do, using literal values just to simplify things...

So say I want to display the result of an expression in a view query column, as a boolean value (or BIT), as True or False. I've tried putting the following expressions into the column and none work:

4 < 5: Access converts this to the string '4 < 5' and it's just displayed as a string.

CAST( '4 < 5' AS BIT ): When run, the query displays the error 'Syntax error converting the varchar value '4 < 5' to a column of data type BIT.

Although I'm using Access 2003, It's just a front end for a SQL Server 2000 database. The actual SQL statement containing the latter SQL function is:

SELECT dbo.Tapes.No, dbo.Tapes.Status, dbo.Tapes.LastWrittenDate, dbo.Tapes.Pool, dbo.Tapes.Location, dbo.TapeJobs.No AS Expr1, dbo.TapeJobs.JobNo,
dbo.TapeJobs.TapeNo, dbo.Jobs.No AS Expr2, dbo.Jobs.Date, dbo.Jobs.Successful, dbo.Jobs.RetentionRule, dbo.RetentionRules.No AS Expr3,
dbo.RetentionRules.Name, dbo.RetentionRules.Description, dbo.RetentionRules.RetentionPeriod, dbo.RetentionRules.RetentionCycles,
dbo.Jobs.Date + dbo.RetentionRules.RetentionPeriod AS AgedJob, CAST('4 < 5' AS BIT) AS Expr4
FROM dbo.RetentionRules INNER JOIN
dbo.Jobs ON dbo.RetentionRules.No = dbo.Jobs.RetentionRule RIGHT OUTER JOIN
dbo.Tapes RIGHT OUTER JOIN
dbo.TapeJobs ON dbo.Tapes.No = dbo.TapeJobs.TapeNo ON dbo.Jobs.No = dbo.TapeJobs.JobNo

I'm new to SQL. I think the CAST function is the way forward, but I just don't know how to force it to resolve the expression '4 < 5'.

Can someone please help ?



--
Paul Anderson

View 8 Replies


ADVERTISEMENT

Transact SQL :: How Query Engine Works While Comparing String With Comparison Operators

Oct 11, 2015

DECLARE @Teams AS TABLE(Team VARCHAR(3))
INSERT INTO @Teams
SELECT 'IND'
UNION
SELECT 'SA'
UNION
SELECT 'AUS'
select Team from @Teams where Team > 'AUS'

[code]....

co-relation between comparison operators in WHERE Clause and the respective output.

View 3 Replies View Related

SQL Server 2012 :: Pull Expected Results When Using Strings With Comparison Operators?

Mar 1, 2015

We can use comparison operators with strings as well. Hence, I tried to use the following query on a SQL Server 2012 instance with the sample AdventureWorks2012 database (the collation of the database and of the column is the default:

SQL_Latin1_General_CP1_CI_AS):

USE AdventureWorks2012 ;
GO

--Returns 5 records
SELECT pp.Name
FROM Production.Product AS pp
WHERE pp.Name >= N'Short' AND pp.Name <= N'Sport' ;
GO

The query only returns 5 records. This despite the fact that the search is an inclusive search and the Production.Product table contains records that begin with "Sport".

Now, when I replace "Sport" with "Sporu" (just moving one character up in the alphabet to verify whether characters after the word have any impact on the search) gives me 8 records.

USE AdventureWorks2012 ;
GO

--Returns 8 records
SELECT pp.Name
FROM Production.Product AS pp
WHERE pp.Name >= N'Short' AND pp.Name <= N'Sporu' ;
GO

What's going on inside of SQL Server that allows it to fetch "Short-Sleeve Classic Jersey" for the starting word "Short" but prevents it from fetching "Sport-100 Helmet" for the ending word "Sport" despite the search being an inclusive search?

View 3 Replies View Related

Valid Expression Types For Operators.

Apr 14, 2008

Hi everybody:

I want know where can I find information about valid expresion types for each one of de Arithmetic Operators, Bitwise Operators, Comparison Operators, Logical Operators, Unary Operators in SQL server. I want something like this.

for (+) ADD, syntaxis -> expression + expression

expression Valid? result type
-----------------------------------------------------------------
int + int ok int
int + bigint ok bigint
char + char ok char <- (+) works like concatenation
char + int ok char???
image + bit error -
binary + int ok binary???



for (*) MULTIPLY, syntaxis -> expression * expression

expression Valid? result type
-----------------------------------------------------------------
int * int ok int
int * bigint ok bigint
char * char error -
char * int error -
image + bit error -
binary + int ok binary????

for (<) LESS THAN, syntaxis -> expresion < expression

expression Valid? result type
-----------------------------------------------------------------
int < int ok bit???
char < char ok bit???
char < int ok bit???
image < bit error -

tks for help.
Jack

View 3 Replies View Related

How To Write A Comparison Expression

Dec 8, 2006

Hi,i need a column in a SELECT statement which returns always "true" (As a boolean value, not as a string)so I first tried SELECT field1, field2, true AS field3but this is not working. If I use "0 AS field3" this returns fine the 0, but this is not a boolean but a int.I also tried to make something like     "0 = 0 AS field"but also errors. In that context I discoverd that I could not compare values in the select field - I can use +,-+,* ... for having something like "2 * field1 AS field3" but I'm not clever enough to figure out how I would have a field "field1 < 12 AS field3" (ok I would use CASE, but I need the boolean return value...)Any ideas?Thanks in advance, Klaushow could I write something

View 3 Replies View Related

Like Comparison Operator In An Expression To Ignore Case

Aug 31, 2007

How do you make the "Like" comparison operator ignore case in an expression??

Expression looks like this:




Code SnippetParameters!CompanyFilterOp.Value = "%",Fields!company.Value like "*" & Parameters!Company.Value & "*"





BTW, the expression above is part of a switch expression, and is at the table level.

Data contains "General Industry" in Company column from database.

User enters "indust" in Company Parameter text box, and result is no data found.

User enters "Indust" in Company Parameter text box, and data is returned.

Thanks in advance for your time in responding.

View 3 Replies View Related

Comparison Query

Aug 24, 2007

Hi guys,

I'm trying to do a comparison of 2 data sets. Basically what I want is: 'where event date from event number -24 is earlier than the event date for event number -13'

To get the eventdate for the eventno's, I have the following 2 queries:

select eventdate
from caseevent, cases
where eventno = -24

select eventdate
from caseevent, cases
where eventno = -13

So what i'm trying to say is: I want it so that the value of the first query is compared to be LESS than the value of the second query...

Any help please????

Thank you!

View 11 Replies View Related

Help With Insert And Comparison Query

Jul 15, 2005

I have two tables, one called SUBURBS and one called REGIONS.

The REGION table is more updated, but is missing certain values that are in the SUBURB table that i need to create a query for to not only compare wether the value existas, but to then insert that value in.
Here are the table structures for the SUBURB and the REGION tables respectivly

MEMRGN (This relates to the EAC_REGION field in REGIONS)
OLDREGION
SUBURB
PCODE
STATE
TempID


EAC_REGION
REMAX_REGION
REMAX_SUB_REGION
SUBURB
PCODE
STATE
BSPNAME
DeliveryOffice
TempID

THANKS for help

View 5 Replies View Related

Tough 2 Year Comparison Sales Query

Dec 17, 2007

I'm developing a 2 year comparison rolling 12 month Sales report but am having problems with the query I'm using. Because I need to include every month (whether no sales or not) I have a calendar table named metaDates and each table gets outer joined as a result. (Forgive the long query) Please see below.

SELECT Customer.country, Order_Line_Invoice.prodcatid, MetaDates.[Month], MetaDates.[Year], isNull(SUM(Order_Line_Invoice.Sales),0) AS Sales , SUM(Order_Line_Invoice.Cost) AS Cost,
( isNull(SUM(Order_Line_Invoice.Sales),0) - isNull(SUM(Order_Line_Invoice.Cost),0) )AS GM,
'Current 12 Months' AS yearNum
FROM MetaDates
LEFT OUTER JOIN Order_Line_Invoice ON (MetaDates.Date = Order_Line_Invoice.InvoiceDate AND (Order_Line_Invoice.prodcatid IN (@GroupByFieldFilter)) )
LEFT OUTER JOIN Customer ON (Order_Line_Invoice.CustId = Customer.CustId and Customer.country IN (@country) )
LEFT OUTER JOIN Product ON (Order_Line_Invoice.ProdId = Product.ProdId)
WHERE (MetaDates.Date BETWEEN dateadd(m, datediff(m, 0, DATEADD(month,-11,@EndDate) ), 0) AND @EndDate)

GROUP BY MetaDates.[Year], MetaDates.[Month], Customer.country, Order_Line_Invoice.prodcatid

UNION
SELECT Customer.country, Order_Line_Invoice.prodcatid, MetaDates.[Month], MetaDates.[Year], isNull(SUM(Order_Line_Invoice.Sales),0) AS Sales , SUM(Order_Line_Invoice.Cost) AS Cost,
( isNull(SUM(Order_Line_Invoice.Sales),0) - isNull(SUM(Order_Line_Invoice.Cost),0) ) AS GM,
'Previous 12 Months' AS yearNum
FROM MetaDates
LEFT OUTER JOIN Order_Line_Invoice ON (MetaDates.Date = Order_Line_Invoice.InvoiceDate AND (Order_Line_Invoice.prodcatid IN (@GroupByFieldFilter)) )
LEFT OUTER JOIN Customer ON (Order_Line_Invoice.CustId = Customer.CustId and Customer.country IN (@country) )
LEFT OUTER JOIN Product ON (Order_Line_Invoice.ProdId = Product.ProdId)
WHERE (MetaDates.Date BETWEEN dateadd(m, datediff(m, 0, DATEADD(month,-23,@EndDate) ), 0) AND dateadd(m, datediff(m, 0, DATEADD(month,-11,@EndDate) ), -1))

GROUP BY MetaDates.[Year], MetaDates.[Month], Customer.country, Order_Line_Invoice.prodcatid
ORDER BY MetaDates.[Year], MetaDates.[Month]


That said the second outer join (Customer.country IN (@country)) never gets executed. It's really a simple concept. "Give me last 2 year sales by month (every previous and last month even if no sales) but only for the country the user is in"

Can someone help me out with this sql statement. Any help would be much appreciated.

View 11 Replies View Related

WHERE Operators

Mar 18, 2005

Hello,

I am trying to filter records according to an exact string case match and the operator = does not seem to do the job.

Executing,

SELECT * FROM Customers WHERE kUserId='admin' AND strPw='abcd'

and

SELECT * FROM Customers WHERE kUserId='admin' AND strPw='aBcD'

always fetches the same record.

So, how do I do about employing case-exact filtering?

Thank you very much.

David

View 1 Replies View Related

OR Operators

Oct 28, 2007

I apologised if this has been posted before. I am having so many problems with these operators.

I can get this to work..

" Select *
from emp
where job is not 'manager';

but not

" Select *
from emp
where job is not 'manager'
or where job is not 'president' ;

View 2 Replies View Related

EXCEPT And INTERSECT Operators

Mar 19, 1999

Am I hallucinating or does SQL Server 6.5 not support the EXCEPT and INTERSECT operators?

View 1 Replies View Related

BETWEEN Clause && &<= Operators

Aug 9, 2006

Hi ,

In a stored procedure when retrieving records based on a DATETIME values in WHERE clause - can we use BETWEEN clause or Col <= AND Col >= ?

Please suggest which is the optimised way.

Thanks in Advance,

Hari Haran Arulmozhi

View 2 Replies View Related

Statement, Operators, Operation.

Mar 21, 2007

Hi I just got a paging procedure from the internet and it’s working just fine, but I would like to return the numbers of pages too. So I used the Count() function to retrieve all records on the table and divided by the page size, but even I doing with float number, this is returning a integer number. I just started with SQL Server, does some knows what is wrong with the following code? or knows a better way to do it.
 
Declare     @Records int,
            @Pages float,
            @hey int
 
Set @Records = (Select Count(*) as 'Friends' From friends
 
Set @Pages = ((@Records) / (@PageSize))
 
Set @hey = (@Pages)
 
if @Pages > @hey
begin
@Pages = @Pages + 1
end
 
return @Pages
 
 
Thank you very much.

View 4 Replies View Related

Execution Plan Different For = And &<&> Operators

Jun 12, 2006

Hi ,

when
operator = then index SEEK
operator <> then index SCAN

Is normal ?

Example

SELECT *
FROM dbo.Batch
WHERE (Status = 'Batch Completed')

(1 row(s) affected)

StmtText
---------------------------------------------------------------------------------------------------------------------------------
|--Bookmark Lookup(BOOKMARK:([Bmk1000]), OBJECT:([PriceAvisPr].[dbo].[Batch]))
|--Index Seek(OBJECT:([PriceAvisPr].[dbo].[Batch].[IX_Batch]), SEEK:([Batch].[Status]='Batch Completed') ORDERED FORWARD)

StmtText
---------------------------------------------------------------------------------
SELECT *
FROM dbo.Batch
WHERE (Status <> 'Batch Completed')

(1 row(s) affected)

StmtText
------------------------------------------------------------------------------------------------------------------------
|--Clustered Index Scan(OBJECT:([PriceAvisPr].[dbo].[Batch].[PK_Batch]), WHERE:([Batch].[Status]<>'Batch Completed'))

View 2 Replies View Related

Conditional Operators In SQL Statements

Oct 28, 2005

95% of our DB Calls are in STored Procedures, however there are a few that we're finding hard to convert.

Example:

string strSQL = "Some Big *** SQL query with 8 inner joins";

If(Some Variable == something)
strSQL += "AND ...':

if(Something == somethingElse)
strSQL += " AND (this > that OR this <= other + 1);

so on and so forth.

Is it possible to put these types of statements in a Stored Procedure so I can get this out of code?

View 3 Replies View Related

Sql Job Notification Sent To Multiple Operators?

Jul 22, 2007

What am I missing? I can only select 1 operator to inform.
Should an 'operator' be redefined to have multiple addresses, if so, how should they be delimited?

View 1 Replies View Related

Overloading Add/subtract Operators For CLR UDT

Oct 13, 2006

Hi,

I have an implementation of the UDT - 3-dimentional vector. In my code I have implemented add, subtract and multiply methods for the type. I have also implemented overloaded operators for +/-/* in my C# code. Those overloaded operator are working as expected in C# tests. However when I€™m trying to use +/-/* operators in T-SQL over my UDT it returns the following error:

Invalid operator for data type. Operator equals add, type equals Vector.

The following fragment does work:

DECLARE @v1 Vector, @v2 Vector, @v3 Vector;



SELECT @v1 = CAST('1,1,1' as Vector), @v2 = CAST('2,2,2' as Vector)



SELECT @v1 'v1', @v2 'v2', @v1.[Add](@v2) 'v1 + v2'

And this fragment does not work:

DECLARE @v1 Vector, @v2 Vector, @v3 Vector;



SELECT @v1 = CAST('1,1,1' as Vector), @v2 = CAST('2,2,2' as Vector)



SELECT @v1 'v1', @v2 'v2', @v1+@v2 'v1 + v2'



I guess that SQL Server is not aware of the operators€™ overload I have implemented in the C# code. Is there any way to instruct SQL Server to use overloaded operators in the T-SQL so the code will look naturally @a + @b instead of @a.[Add](@b) and as a result use standard summary functions SUM() instead of writing user defined aggregate function for the Vector type field?

Maxim

View 4 Replies View Related

Alerting Operators For All Jobs

Jan 26, 2007

Hi there,

I'm not sure which section this really comes under and I think 'availability/disaster recovery' is probably the most applicable, sorry if it isn't.

I have SQL Server 2005 set-up and about 50 jobs listed, now, these jobs were configured before an operators with alerting by email was set-up... so, none of the jobs when fail alert an operator.

Is there any way I can automate a solution so if any job fails a designated/or default operator will be emailed and told what happened? Or would I need to edit each job manually to set this?

Thanks
Ed

View 1 Replies View Related

Subquery With Operators - Finding Records?

Jun 19, 2012

I've got a subquery that keeps throwing up an error but I can’t think of another way of completing the query.

Firstly I need to find records where TestQty =3

(this would find 2 records with TestQty =3, TestNumber, 7171003 and 7088650)

The TestNumber is not unique so I would like the final set of records to include all the records with TestNumber, 7171003 and 7088650

TestNumberTestQty
7088650____________3
7088650____________1
7088650____________2
7088650____________1
7088650____________2
7171003____________1
7171003____________3
7171003____________2

Code below:
[Code SQL]
USE TestWarehouse
IF ('dbo.TestItems') IS NOT NULL
DROP TABLE [dbo].[TestItems];
GO
CREATE TABLE [dbo].[TestItems]
( TestItem int not null IDENTITY (1,1)

[Code] .....

View 5 Replies View Related

Sql Stored Procedure With Custom Operators

Dec 29, 2007

Hi:

I am trying to create a stored procedure that filters some customers. The field in wich I am trying to apply the filter is the age field. The problem is that I need to be able to select the comparison operator =,<,>,=<,>=,<>.
I was trying to do it with the following code:

Select CustomerName From Customer Where
(CustomerAge & @Operator & @Age)

But sql Server shows an error telling me that @Operartor couldnt be converted to int.

I dont know if I am in the right track or way off, how is this done?

View 3 Replies View Related

Sp_trace_setfilter Mixing AND/OR Operators In Profiler

Jul 24, 2007

Hello, how do you setup a Profiler filter, that has mixed AND/OR operators. Thru the Profiler GUI, I don't even see how you would ask for any statement/proc with READS over 10,000 OR DURATION over 1000ms. How do you do an "OR" thru the GUI?



Forgetting the GUI and doing traces thru scripts, the @logical_operator isn't too logical, and I can't find any description for setting this parameter. If you only have one filter, it doesn't matter if you set it to 0 (AND) or to 1 (OR)... But if you want multiple filters, so one filter is Reads >= 10,000 and the other filter is Duration >= 1000ms., how do you do that? I tried it with the @logical_operator of "1" on both, but then I also got other events with a NULL value in READS.




Code Snippet

-- @traceID = 1
-- @columnID = 13 (Duration)
-- @logicalOperator = 1 (OR)
-- @comparison_operator = 4 (greater or equal)
-- @value = 1000000 (1000 ms)


sp_trace_setfilter 1, 13, 1, 4, 1000000


-- @traceID = 1
-- @columnID = 16 (Reads)
-- @logicalOperator = 1 (OR)
-- @comparison_operator = 4 (greater or equal)
-- @value = 10000 (# Reads)

sp_trace_setfilter 1, 16, 1, 4, 10000


Looks like DURATION is never NULL for these events>>>



RPC:Completed

SP:Completed

SPtmtCompleted

SQL:BatchCompleted

SQLtmtCompleted



but the READS value cane be null (for SP:Completed at least).



Any ideas on how to mix AND/OR operators in multiple filters of one trace?



Thanks, Bruce

View 1 Replies View Related

Syntax Of Operators And Common Functions In Expressions

Apr 4, 2008

Hi all, real basic question:
I can't seem to find a basic reference that tells me the syntax and allowable values of parameters in common functions such as Format or CDate when editing a Field Expression in Visual Studio (Report Definition Language?). Where would I start?

For example, I've discovered that the Format function "Returns a string formatted according to instructions contained in a format String expression.", and the string expression can have values like "D" and "d" which produce different results, but where would I find out what the allowable string expressions are and their meaning?

I have also been guessing at the syntax of the CDate command with no luck. I need a reference that tells me what the different function parameters mean.

thanks
Jac

View 1 Replies View Related

Update Sub Query In Case Expression

Oct 3, 2005

Hello everyone,
is there anyway to use an update sub query in a case expression , something like this for exampleselect username,(case when password ='606' then (update users set username = 'me' where id= '3') else password end) from users i have been googling this issue just with no usefull resultsthanks for any replyMahmoud Manasrah

View 3 Replies View Related

Oledb Source Query Through Expression

Jan 10, 2012

I am putting the below query in a OLEDB SOURCE through a variable (it is a select statement with a where clause from one date to another).

"select TestRecordtype, request_id from department
where LOAD_TMSTP between
(select max(END_TMSTP) LOG) and
(TO_DATE("+RIGHT("0" + (DT_STR,4,1252)DATEPART( "dd" , @[System:tartTime] ), 2) + "-"
+RIGHT("0" + (DT_STR,4,1252)DATEPART( "mm" , @[System:tartTime] ), 2) + "-"
+RIGHT("0" + (DT_STR,4,1252)DATEPART( "yy" , @[System:tartTime] ), 2) + " "
+RIGHT("0" + (DT_STR,4,1252)DATEPART( "hh" , @[System:tartTime] ), 2) + "."
+RIGHT("0" + (DT_STR,4,1252)DATEPART( "mi" , @[System:tartTime] ), 2) + "."
+RIGHT("0" + (DT_STR,4,1252)DATEPART( "ss" , @[System:tartTime] ), 2) +",'DD-MM-YY HH24.MI.SS')) "

View 1 Replies View Related

Update Table Using Sub-query With Expression

Jan 17, 2014

Here is what I have:

UPDATE A SET ConsumerLogon =
(SELECT email FROM TABLE B
WHERE userNumber = LEFT (A.ConsumerLogon ,CHARINDEX ( '@' , A.ConsumerLogon , 1 ) -1) )

Seems like the subquery expression does not receive ConsumerLogon from the outer query.is this possible to refer to outer query in subquery expression?

View 4 Replies View Related

Ms Query Sql Error 'Incorrect Column Expression'

Jul 22, 2005

I am getting an error from the case part of the select statement below which reads 'Incorrect Column Expression' then it quotes the case statement. All I am trying to do is convert and return the weight value to kilos if it was entered in pounds.

SELECT Salesinv.Unique, Salesinv.SalesNo, Salesinv.PurchNo, Salesinv.SalesInvNo, Salesinv.InvValue,

(case when Salesinv.WUnits = 'Llb' then round(Salesinv.NettWeight/2.2046,0) else Salesinv.NettWeight end)

FROM Salesinv Salesinv
WHERE (Salesinv.Unique>=38397.3092 And Salesinv.Unique<=38537.39885)

Any help would be greatly appreciated, hopefully thanks in advance.

View 12 Replies View Related

Incorrect Column Expression With CHAR In MS Query

Jan 16, 2014

I am working with Excel, then within Excel I am using MS Query to query a database. I am trying to use the CAST function on a field with numbers (1,2 or 3 digits) so I can convert it to a text value with three digits, i.e. 1 would read 001, 12 would read 012, etc.

I am not using CAST in the design grid. Is this even possible?

I am modifying the underlying SQL code. Here is the line that is giving me trouble:

CAST(GL02GLF.GLF_SEQ_NUM as CHAR(3)) as “Sequenceâ€

View 1 Replies View Related

2005 Expression Edition Install Query

Mar 1, 2006

I have SQL Server 2000 Developer Edition on my laptop which I want to remain for work development purposes (my work uses SQL Server 2000). However, I'm developing a .NET application which requires a database back-end.

Can I install SQL Server 2005 Express Edition alongside SQL Server 2000? Or does 2005 overwrite 2000?

If no to the first question then how do I develop the system/database in SQL Server 2000 but delpoy it to the user using 2005 Express Edition?

Thanks.

View 1 Replies View Related

Attempting To Select A Range Of Values Using Wildcard And Between Or Logical Operators?

Mar 16, 2014

I am in the midst of writing a query to return a range of product BIN LOCATIONS from a warehouse stock levels program.I know the start and end BIN LOCATIONS for the warehouse, e.g.: Start - #00000, and End - Z10000.However I cannot hard code these into the program, instead I want my operator to designate the first letter of both the start and end BINS locations, and then hit the 'go button'.Towards this end I have declared a couple of variables in my SQL, as follows -

Code:
declare @strBin varchar(10)
set @strBin = ''
if @strBin = ''
set @strBin = '#%'

declare @endBin varchar(10)
if @endBin = ''
set @endBin = 'z%'

My challenge is writing a relevant WHERE clause for my select statement, I have tried the following -

Code:
where BINLOCAT.BINLABEL between @strBin and @endBin
order by BINLOCAT.BINLABEL

Whilst the clause above does not cause any errors, neither does it return any results.My first thought is that the BETWEEN operator does not accept wildcards. But if this is correct then how do I go about allowing an operator to enter the start, and end BINS without typing the entire BIN string (e.g.: #00000)? I have tried >= @strBin and <= @endBin, but I am having a similar issue with no errors, and no data returned.

View 9 Replies View Related

URGENT - My Error Or Bug? The Result Of The Expression Cannot Be Written To The Property. The Expression Was Evaluated, But

Feb 8, 2007

Error 3 Error loading MLS_AZ_PHX.dtsx: The result of the expression ""C:\sql_working_directory\MLS\AZ\Phoenix\Docs\Armls_Schema Updated 020107.xls"" on property "ConnectionString" cannot be written to the property. The expression was evaluated, but cannot be set on the property. c:documents and settingsviewmastermy documentsvisual studio 2005projectsm l sMLS_AZ_PHX.dtsx 1 1


"C:\sql_working_directory\MLS\AZ\Phoenix\Docs\Armls_Schema Updated 020107.xls"

Directly using C:sql_working_directoryMLSAZPhoenixDocsArmls_Schema Updated 020107.xls
as connectionString works

However - I'm trying to deploy the package - and trying to use expression:
@[User::DIR_WORKING] + "\Docs\Armls_Schema Updated 020107.xls"
which causes the same error to occur

(Same error with other Excel source also:
Error 5 Error loading MLS_AZ_PHX.dtsx: The result of the expression "@[User::DIR_WORKING] + "\Docs\Armls_SchoolCodesJuly06.xls"" on property "ConnectionString" cannot be written to the property. The expression was evaluated, but cannot be set on the property. c:documents and settingsviewmastermy documentsvisual studio 2005projectsm l sMLS_AZ_PHX.dtsx 1 1
)

View 4 Replies View Related

How To Protect From SQL Injection In ASP.NET And SQL 2005 For Custom Query Expression?

Oct 3, 2006

How to Protect From SQL Injection in ASP.NET and SQL 2005 for custom query expression?In my project, I allow user to custom query expression through UI, such asstring queryCondition=' sale>20 and sale <100'string queryCondition=' createDate>"10/10/2005"'string queryCondition='Fullname like "%Paul%" '...I construct SQL based the queryCondition string, such as string mysql='select * from mytable where '+queryConditionI know it's very dangerous because of SQL Injection, but it's very convenient for user to custom query expressionCould you tell me how to do? many thanks!

View 13 Replies View Related

Syntax Error (missing Operator) In Query Expression

Jan 22, 2008

Hi, Please could someone assist - the above error occurs.  This is my code: Protected Sub btnReport_Click(ByVal sender As Object, ByVal e As System.EventArgs)        ' Response.Redirect("CrystalreportTEST_Print.aspx?C_id=" & ddlCompany.SelectedValue)        Dim myConnection As New OleDbConnection(connString)        Dim Str As String = "SELECT clientid,company FROM Client WHERE company =" & ddlCompany.SelectedItem.Text        Dim cmd As New OleDbCommand(Str, myConnection)        Dim ds As New DataSet        Dim da As New OleDbDataAdapter(cmd)        da.Fill(ds)        Label7.Text = ds.Tables(0).Rows(0).Item("clientid")        ' Response.Redirect("CrystalreportTEST_Print.aspx?C_id=" & ds.Tables(0).Rows(0).Item("clientid"))    End Sub  Thank you in advance 

View 1 Replies View Related







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