'Go' Keyword Being Interpreted In Literal

Apr 1, 2008

Hi,
A really basic problem in psuedo code...

select * from mytable where email = 'test@go.com'


This throws back:

Unclosed quotation mark before the character string 'test@'.
Line 1: Incorrect syntax near 'test@'.

Unclosed quotation mark before the character string ''.

Because of the 'go'. Other addresses featuring 'go' suffer the same problem. How do I escape it?


Thanks,
Joe

View 4 Replies


ADVERTISEMENT

Date Parameter Format Incorrectly Interpreted

Oct 18, 2005

Hi,

View 11 Replies View Related

My Today Morning Date Is Interpreted As Part Of Yesterday

Oct 16, 2007

OK, the thread's name is not very self explanatory so here I go:

The fact
I'm working on a simple APP where I store the date of a transaction. I use in my Stored Procedure the getdate() as the default (and untouchable) value for the transaction date

The problem:
These transactions are made all day long and there are transctions made on the morning and afternoon. Now, when I make a report of the transactions for one specific range of days, all the transactions made in the morning of the start date are ignored completely.

Say I have these transactions
TCode TType TDate
45 REQ 03/09/2007 08:20:16 a.m.
46 REQ 03/09/2007 11:59:43 a.m.
47 REQ 03/09/2007 12:01:30 p.m.
48 REQ 03/09/2007 06:01:49 p.m.

and I make this query
SELECT * FROM <Table Name> WHERE TDate BETWEEN <Start Date> AND <End Date>
(where <Start Date> && <End Date> are 03/09/2007 selected from a DateTimePicker control)

I only get these results 47 REQ 03/09/2007 12:01:30 p.m.
48 REQ 03/09/2007 06:01:49 p.m.


if I make a cast as integer I get these results:
TCode TDate TCast
46 2007-09-03 11:59:43.000 39326
47 2007-09-03 12:01:30.000 39327


so my question is
Why are the Morning Transactions from the start date ignored (or interpreted as part of previous day transactions) ?

View 1 Replies View Related

AS 400 Data Being Interpreted As Unicode Strings (DT_WSTR) Datatype

Jun 23, 2006

I am building a data warehouse. Some of the data comes from an AS 400 EPR system. I used the OLEDB connector when first pulling the data into SQL Server doing simple import data from table option. That worked great for getting the initial data load into SQL Server and creating the base SQL Server tables although it was excruciatingly slow (that was probably due to the transport from the AS 400).

Now, I need to get new records that are added to the AS400 side of things on a daily basis. For that, I was trying to use the OLEDB AS400 connector. However, I found that the OLEDB connector wouldn't work when I was trying to specify an SQL Statement for what to get; i.e., a simple query like Select * from TWLDAT.STKT where BYSDAT >= '2005-01-27' would simply not work. Found articles here explaining that it is probably a problem on the AS400 side of things and where people recommended using an ADO ODBC data reader source for this type of thing. So, I'm trying to implement that. However, I have a huge problem with it.

The original tables that got created were mapped to use NVARCHAR fields for character data. When the ADO ODBC data reader source accesses the AS400 data, it insists on interpreting the string type fields as being unicode strings and giving it a data type of DT_WSTR when what I need it to have is a plain old DT_STR data type. When the strings are interpreted as unicode strings, they cannot be converted in a way that allows the NVARCHAR fields to be filled with the data. The exact error message I get for all the fields that should wind up being nvarchar fields is as follows:

Column "BYStOK" cannot convert between unicode and non-unicode string data types.

Okay, so I try to change the data types in the ADO ODBC data reader to be plain DT_STR data types and I cannot do so.

Does anyone have any idea why the ADO ODBC data reader source insists on interpreting the string data coming from the AS 400 as unicode string data or why it refuses to allow that to be changed to DT_STR data type?

Thanks in advance for any info. By the way, if there is a better way than the ADO ODBC data source to get at this data when I need to specify an SQL command, I would love to hear about it. Not wild about using ODBC in the OLEDB age.



Steve Wells

View 9 Replies View Related

SQL Svr 2005 Nvarchar(MAX) Interpreted As TEXT Fiields When Linked To MS Access 2003

Apr 4, 2008



Hi, We have moved our Access 2003 database to SQL Server 2005. A number of the original tables contained MEMO fields and these became nvarchar(MAX) fields in SS 2005. We continue to use the original Access application and therefore have linked the tables to the Access application via ODBC connection. However, the fields that were originally Memo in Access native tables are brought over as TEXT fields (255 char limit) by the linking process.

Is there a way I can link the tables and have those big text fields be Memo fields in the linked tables?? Or is there some way to work around this? (Moving to Access 2007 is not an option at this time.) I would really appreciate any suggestions!
Thanks.

View 1 Replies View Related

DB Design :: Can Interpreted Tables Be Accessed By Natively Compiled Stored Procedures

Jun 15, 2015

But it doesn't explicitly tell wherther Interpreted (disk-based) tables can be accessed by Natively compiled stored procedures.And SQL Server Express edition doesn't allow creating Memory-optimized objects to very this.

View 2 Replies View Related

Literal Value With IN Clause

Apr 12, 2006

Howdy,Is it okay to use a literal value with the IN clause. E.g.SELECT somefield, anotherfield.....WHERE ...etc.AND 1234 IN (SELECT userid FROM tblUsers)I was told it wasn't valid, but I'm pretty sure it worked for me. Justseeking clarification.cheers,

View 2 Replies View Related

How To Use A Parameter In Place Of A Literal?

Oct 5, 2007

I have a stored procedure that starts like this:

.
.
.
UPDATE Employees
set depth=0, hierarchy=NULL

UPDATE Employees
set depth=1, hierarchy=right(@MaxPadLength + CAST(Employees.Parent AS varchar(255)),@DisplayPadLength)
where Child = Parent

WHILE EXISTS
(
SELECT *
FROM Employees
WHERE Depth=0
)
.
.
.
I have many tables that have the same structure as the Employees table but have different names. I would like to pass the PS a paramater with the table name I want to process. My question is what is the correct syntax to use a parameter in place of the literals for the table name?

Thanks

View 4 Replies View Related

Get Literal Month From Date

Oct 25, 2007

I am trying to extract the month from a date field, and I am able to get the integer for the month, however, when I try to convert the integer to the literal, e.g. 3 to March, I am having issues.

I have a field called PROCES, which represents a date processed, which is numeric(8).... i.e. 20061231.

I am using:
SELECT datepart(mm,cast(convert(char(8),PROCES)as datetime))
which gives me the correct integer.

When I try:
SELECT datename(mm,datepart(mm,cast(convert(char(8),PROCES)as datetime)))

I get January for all records...?

Does anyone know why, and how to fix.

Thanks

View 1 Replies View Related

Select * From Something Where Field1 = N'literal'

Jul 23, 2005

What exactly is happening when a query is sent using the N in front ofthe string to be found?Under what conditions would someone use the N' in a query?I have been testing out some chinese text. I set up some fields ofnVarchar, nText and it works with an N. Without the N, it wont work.N also works with fields of varchar and text for english.Would this ever cause a problem to a query depending on how themachines regional settings are set? Why not just put N in all of thequeryies?If anyone has some ideas, I would be grateful for any and allinformation about the N.

View 1 Replies View Related

Too Many Characters In Character Literal?

Feb 24, 2008

Hello,

I am trying to insert some values retrieved from textboxes into an Access DB using ASP.NET. When I try to run this code I get an error reading "Too many characters in character literal". What does this mean? Also, how do I break new lines, does way this look ok?



string connectionString = ConfigurationManager.ConnectionStrings["ConnectionString1"].ConnectionString;

string sQuery2 = INSERT INTO Member(FirstName, LastName, StreetAdress, PostalAdress, Telephone, Email),

VALUES ('strFirstName', 'strLastName', 'strStreetAddress', 'strPostalAddress', 'strTelephone', 'strEmail');




OleDbConnection oOleDbConnection = new OleDbConnection(connectionString);

oOleDbConnection.Open();

OleDbCommand command2 = new OleDbCommand(sQuery2, oOleDbConnection);

OleDbDataReader reader2 = command2.ExecuteNonQuery();

View 8 Replies View Related

String Literal Problem

Aug 8, 2006

hi!

din't work. I need some thing in C# that can execute like this:

This works in SQl Query perfectly.

xp_cmdshell 'dtexec /f "D:\SSISProject\Integration Services Project1\ArchiveMainMultiTables.dtsx"/Set package.Variables[User::connectst].Properties[Value];""Data Source=SE413695AASQL2005;Initial Catalog=TestDB;Provider=SQLNCLI.1;Integrated Security=SSPI;""'

How do we interpret in c# currently i have some thing like this which is not correct i need to fix this to work in C#

string conn = @"""Data Source=SE413695AASQL2005;Initial Catalog=TestDB;Provider=SQLNCLI.1;Integrated Security=SSPI;""""";

path = @"""D:SSISProjectIntegration Services Project1ArchiveMainMultiTables.dtsx";

jobCommand = new SqlCommand(@"xp_cmdshell 'dtexec /f " + path + "" /Set \package.Variables[User::connectst].Properties[Value]; " + conn + ""'", cconn);



Thanks,

Ja

View 5 Replies View Related

String Character Literal In C#

Aug 7, 2006

when i execute in sql this works fine:

xp_cmdshell 'dtexec /f "D:SSISProjectIntegration Services Project1ArchiveMainMultiTables.dtsx" /Conn TahoeDB;"Provider=SQLNCLI.1;Data Source=SE413695AASQL2005;Initial Catalog=TestDB;Provider=SQLNCLI.1;Integrated Security=SSPI;"'

but when i execute in C# i get this value

string connect = @"TahoeDB;""Data Source=SE413695AASQL2005;Initial Catalog=TestDB;Provider=SQLNCLI.1;Integrated Security=SSPI;""";

xp_cmdshell 'dtexec /f "D:\SSISProject\Integration Services Project1\ArchiveMainMultiTables.dtsx" /Conn "TahoeDB;"Data Source=SE413695\AASQL2005;Initial Catalog=TestDB;Provider=SQLNCLI.1;Integrated Security=SSPI;"" ' -- this thorughs up error in sql

Option "Source=SE413695\AASQL2005;Initial" is not valid.This is basically after Data there is a space till Initial and then space catalog.

what should i do ? any help

thanks,

Jas

View 3 Replies View Related

How To Convert Literal String To Unicode ?...

Aug 6, 2007

Hi,
I want to convert literal string to unicode before insert into the database. and after insertion i want to retrive this value from data base and convert back to literal string.
pls tell me how to incode and decode literal string to unicode and from unicode to literal string.

View 2 Replies View Related

Find Literal Underscore - Not Wildcard

Mar 21, 2005

In MS Sql 2000 - is it possible to find the literal underscore character (_). Something like:

SELECT * FROM foo WHERE bar like 'a\_%'

where the query would return "a_abc", "a_cba", and "a_lksdfjlkdsjlksjdfl", but not "abc"?

I've tried:
SELECT * FROM foo WHERE bar like 'a\_%'
SELECT * FROM foo WHERE bar like ( 'a' + CHAR(95) + '%' )

Any other suggestions?

View 1 Replies View Related

Excel Export Footer Is A Literal?

May 3, 2007

When a report is exported to Excel, the footer is set to a literal "page 1 of 1" even though it's specified as



="Page " + CStr(Globals!PageNumber) + " of " + CStr(Globals!TotalPages)



in the rldc report definition.

Hence, if you print from Excel every page has the 'page 1 of 1' footer. Not very useful.

Is there a way to either suppress the output of the footer (only when going to Excel cause you need it when exporting to PDF) -or- get it to generate the correct excel footer of 'page 1 of ?'????

Thanks,

View 1 Replies View Related

Transact SQL :: Using Literal In Openquery Where Clause

Aug 14, 2015

I'm struggling with the syntax for qualifying an openquery's results with a where clause. I copied this from examples on the web but get the error   incorrect syntax near '32810'.

declare @sysid varchar(50) = '32810C534D01C920E7CB07EBC0A80122'
declare @sql varchar(500) =
'select * from OPENQUERY(WAREHOUSE,''select * from xxx.yyyy where sys_id = ''' + @sysid + ''''')'
exec(@sql)
selecting @sql it looks like
select * from OPENQUERY(WAREHOUSE,'select * from xxx.yyyy where sys_id = '32810C534D01C920E7CB07EBC0A80122'')

View 6 Replies View Related

How To Code DateTime-Literal In SQL Server

Apr 20, 2006

Hi,

I'm a newbee to SQL Server. I have a very simple question to you experts: How should I code a literal of the "datetime"-Datatype? For Example in the VALUES-clause of an SQL-statement. I have tested several "formats" ('20.04.2006 11:15:00' with an 4-digit year enclosed in single apostrophes) but all i earned is an exception!

Any help very appreciated!

Thanks in advance and best regards

Reiner

PS.: I'm using a german-localized database (thus the date-format dd.MM.yyyy).



View 9 Replies View Related

Different Plans With Literal String Vs. Param

May 9, 2008

The proc below does two queries that are functionally identical. The only difference is that one LIKE 'foo%', and the other uses LIKE @searchText, where @searchText = 'foo%'.

But the first does an index seek, and the second does an index scan -- and it makes a big difference in performance. (Timing stats are below.)

How can I make the second query seek instead of scanning?


CREATE PROCEDURE test_like

@searchText nvarchar(64)

AS


-- Straight literal string search

SELECT companyId

FROM companies

WHERE searchbrand LIKE 'foo%'




-- With param

SELECT companyId

FROM companies

WHERE searchbrand LIKE @searchText

OPTION(OPTIMIZE FOR(@searchText = 'foo%'))

GO


EXEC test_like 'foo%'




-- Query 1:

SQL Server Execution Times:

CPU time = 0 ms, elapsed time = 1 ms.


-- Query 2:
SQL Server Execution Times:

CPU time = 47 ms, elapsed time = 40 ms.

View 4 Replies View Related

Quoted Literal Strings Won't Force A Phrase Match

Jan 18, 2008

Hello all,

From what I've read, SQL Server is supposed to do a phrase match when you do a full text search that contains quoted literals. So, for example, if I did a full text search on the phrase "time out" and I put it in quotes, it's supposed to search for the full phrase "time out" and not just look for rows that contain the words "time" or "out." However, this isn't working for me.

Here is the query that I'm using :

SELECT *
FROM Content_Items ci
INNER JOIN FREETEXTTABLE(Content_Items, hed, '"time out"') AS ft ON ci.contentItemId = ft.[KEY]
ORDER BY ft.RANK DESC

What's it's doing is this : it's returning a bunch of rows that have the words "time" or "out" in the column called hed. It's also returning rows that have the full phrase "time out", but it's giving those rows the same rank as rows that only contain the word "time." In this case, that rank is 180.

Is there anything else I should be doing in my query, or is there some configuration option I should have turned on?

Thanks.

View 1 Replies View Related

Web Service Task And Document/Literal Calling Convention

May 6, 2008

The Web Service Task seems to support calling methods using parameters but not (as far as I can see) using the Document/Literal calling convention. Is this correct? Is this likely to change in the future?

Thanks

*** Campbell

View 5 Replies View Related

Frror: 4000 Max String Literal In Expression For Datareader Component

Apr 15, 2006

Hi, I have a datareader component of which i am dynamically setting its sqlcommand statement with expression (click the background of dataflow > properties > expressions). Now my sql select statement has about 600 fields so that makes my expression statment "select field1, field2, .....from table1 where field2 >=" + @[User::dateforfield2] but when i evalute the expresssion (which is right), i get the error: A string literal in the expression exceeds the maximum allowed length of 4000 character and i think its because of the fields in my select statment causing my string literal to grow more than 4000 characters. Is there any way to increase the max string literal for expressions. Please help.

View 1 Replies View Related

Reporting Services :: SSRS Report - Need To Remove A Default Literal

Nov 9, 2015

I am working on SSRS report deployed on the sharepoint.

By default, it is displaying " Microsoft SQL Server Reporting Services " on the report

How can that be removed?

Secondly as I don't have the requirement to default the report parameters so I am getting

"Specify parameter values ............... button "

Any way to replace it with some other text etc...

View 2 Replies View Related

SQL Server 2012 :: Case Statement On Nvarchar With Literal String Comparison To Varchar?

Apr 14, 2015

how SQL 2012 would treat a literal string for a comparison similar to below. I want to ensure that the server isn't implicitly converting the value as it runs the SQL, so I'd rather change the data type in one of my tables, as unicode isn't required.

Declare @T Table (S varchar(2))
Declare @S nvarchar(255)
Insert into @T
Values ('AR'), ('AT'), ('AW')
Set @S = 'Auto Repairs'
Select *
from @T T
where case @S when 'Auto Repairs' then 'AR'
when 'Auto Target' then 'AT'
when 'Auto Wash' then 'AW' end = T.STo summarise

in the above would AR, AT and AW in the case statement be treated as a nvarchar, as that's the field the case is wrapped around, or would it be treated as a varchar, as that's what I'm comparing it to.

View 3 Replies View Related

Incorrect Syntax Near The Keyword 'SELECT'.Incorrect Syntax Near The Keyword 'else'.

May 22, 2008

What I am trying to create a query to check, If recDT is not value or null, then will use value from SELECT top 1 recDtim FROM Serv. Otherwise, will use the value from recDT. I have tried the below query but it doesn't work. The error says, Incorrect syntax near the keyword 'SELECT'.Incorrect syntax near the keyword 'else'.1 SELECT
2 case when recDT='' then SELECT top 1 recDtim FROM Serv else recDT end
3 FROM abc
4
Anyone can help? Thanks a lot.

View 5 Replies View Related

In Keyword With INT

Oct 18, 2007

I am trying to pass several ids to use in a where clause.   1 For Each row as GridViewRow In gv_child.Rows
2 If row.RowType = DataControlRowType.DataRow Then
3 Dim chk as CheckBox = CType(row.FindControl("cb_Approve"),CheckBox)
4 If chk IsNot Nothing AndAlso chk.Checked Then
5 Dim id As Integer = CInt(CType(row.FindControl("lbl_id"),Label).Text)
6 ids &= "," & id
7 End If
8 End If
9 If ids.Length > 1 Then ids = ids.Substring(1)
10 'Submit to sql with ids as param...
11 Next

 
I am getting an exception.  Error converting '38,39' to a column of datatype int.  What am I doing wrong?

View 7 Replies View Related

BETWEEN Keyword

Mar 6, 2004

I need to retrieve records where the date is in between the current date and 4 days previous.

I've tried: WHERE DateSubmitted BETWEEN GetDate() AND GetDate() - 4
it doesn't work...

Can someone help out?

View 2 Replies View Related

Is Name A Keyword?

Dec 27, 2005

It's blue in SQL Studio but I can't find it in SQL Books on-line. Iwanted to use it as a field name but don't like using [].Is it reserved?

View 6 Replies View Related

GO Keyword

Nov 21, 2007

Hi guys,

Just a newbie question here.

Do we really need to use the GO keyword?

Thanks,

MeTitus

View 1 Replies View Related

Keyword Search

May 27, 2007

I am trying to implement a band search on my web site (concert listings) and would like it to behave a bit more intelligently than a standard match on the band name.
At the moment I have a stored procedure that just selects every show that features a band with exactly the same name as the search term. What I'm now trying to do is when the user enters a band name containing the '&' character I would also like to search using the word and 'and'. For example, if they search for 'Rise & Fall', they should get details on all shows featuring 'Rise & Fall' OR 'Rise And Fall'. Is it possible to do this within my stored procedure?

View 2 Replies View Related

Search By Keyword

Jan 31, 2008

 Greetings,  I am a php developer, and running a little bit out of deadline in a project. Can someone provide me with a VERY simple way to implement search by keyword in C#?  I have already implemented a search page (according to firstname, lastname etc) that works on a drop down menu (where you have the option to choose seach by keyword) . So, I need to change something in my SQL query to make this work. I already knew from my SQL experience that the simplest and probably the SLOWEST and MOST UN EFFICIENT one was using LIKE. I don't mind using it but I can't since I will end up  having something close to that: SELECT * FROM users WHERE keyword_entered LIKE @keyword;      (or '@keyword)  which does not work.      however SELECT * FROM users WHERE keyword_entered LIKE 'somename%'; does work! I guess the trick is in putting the % after the keyword. ( I would have done that in php by putting the entered keyword in a string and than add to it % and pass it to the SQL query and I dunno how to do that in .NET)any ideas? 

View 7 Replies View Related

Using Keyword Question...

Apr 3, 2008

Hi everyone,
 I have a few classes representing my data layer for my ASP.Net 2.0 Web Application. For example, UserDAL, DocumentDAL, etc... All these classes derive from BaseDAL, which stores the SqlConnection in it. The DAL classes access it through a property. The property is defined like that:
private SqlConnection connection;public SqlConnection Connection{get{  if (connection == null)                 connection = new SqlConnection();  if (connection.State != ConnectionState.Open)  {                connection.ConnectionString = ConnectionString;                 connection.Open();    }  return connection;}}
The constructor of each DAL class is overloaded and takes a SqlConnection object. So if I need to access two DAL classes, I pass the connection of the first, to the second to prevent opening and closing the connection again and again. Here is a sample: UserDAL userDAL = new UserDAL();
userDAL.DoSomethingAndAccessConnectionProperty();

// Now userDAL.Connection is opened. Pass the connection to the constructor of DocumentDAL
DocumentDAL documentDAL = new DokumentDAL(userDAL.Connection);
documentDAL.AlsoDoSomething();
So, if I do the following:using (UserDAL userDAL = new UserDAL())
{
userDAL.DoSomethingAndAccessConnectionProperty();

DocumentDAL documentDAL = new DokumentDAL(userDAL.Connection);
documentDAL.AlsoDoSomething();
}
I assume that the connection is removed from memory, even if the DocumentDAL class has also used it. Am I right? I want to be sure that there will be no open connections.Thanks

View 6 Replies View Related

Keyword Query

Jan 9, 2004

I have a sample photo database where we have added keywords to search for photos. I wanted a way to list all of the keywords that are in the database individually. The problem is in my keyword field there are many keywords seperated by a comma.

Ex: "bull, barrel, rodeo, western, cowboy" would in the keyword field for one photo.

I wanted to select distinct all of the individual words from each keyword field in all of the records.

Can this be done? What would the query look like?

I am looking for a list like:

bull
barrel
rodeo
western
cowboy

Any suggestions?

Thanks,
Rob

View 6 Replies View Related







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