/ Forward Slash Escape Character?

Feb 19, 2008

im having trouble getting this to work:

alter proc [ProGeneral_College_Structure] @Year nvarchar(4)
as
begin
DECLARE @SQLStatement nvarchar(1000)

Set @SQLStatement = 'SELECT School AS Level1Code, DIVISIONS.Div AS Level2Code,
DIVISIONS.ProgArea AS Level3Code, DIVISIONS.progName AS LevelName
, ' + SUBSTRING(@Year,1,2) + '/' + SUBSTRING(@Year,3,2) + ' AS AcademicYearID FROM DIVISIONS
WHERE (((DIVISIONS.[' + @Year + '])=1))
ORDER BY DIVISIONS.School, DIVISIONS.Div, DIVISIONS.ProgArea'

EXEC(@SQLStatement)
end

It's something to do with the / concatenation I think, is it an escape character or something tried // obviously and CHAR(47).
before I get comments I know it's dynamic sql and it's not great but I can't edit the divisions table so have to use a dynamic column.

View 11 Replies


ADVERTISEMENT

Using LIKE With Underscore And Forward Slash..

Jul 23, 2005

Hello All,DDL Statements:CREATE TABLE [dbo].[Table1] ([MyDate] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL) ON [PRIMARY]GOI have a varchar column which represents dates in YYYYMMDD and MM/DD/YYformats. If I query using:SELECT MyDate FROM Table1WHERE DOB LIKE '________'Why aren't the dates in MM/DD/YY returned ? Is the / a specialcharacter in T-SQL ?Thanks in advance

View 1 Replies View Related

What Is The ESCAPE CHARACTER?

Nov 9, 2004

Hi Ya'll,

I tried searching for "escape character", "quotes", etc, but they didn't work.

I'm having troubling inserting data into my tables, if they have an apostrophe or double quotes. I know that MySQL's escape character is "", but I tried it for MS SQL and it didn't work. HOW DO I INSERT DATA INTO MY DB THAT HAS AN APOSTROPHE OR DOUBLE QUOTE? Thanks.

View 1 Replies View Related

Escape Character For /SET Option Of Dtexec

Jan 25, 2006

I have a problem setting some variables in a package using the /SET option of dtexec. Specifically when the value I want to set contains a semi-colon. I get an error like:

Argument ""Package.Variables[User::Delim].Properties[Value];^;"" for option "set" is not valid.

I am guessing that I will have to escape the semi-colons somehow, but with what?

Regards,
Lars

View 9 Replies View Related

How Do I Escape A New Line Character Thats Been Stored In Sql Server

May 30, 2008

Not sure if this is the right forums to ask this question..
I have a website in which i have a text box that has multiline = true... So suppose if if the user enter absbsbcjd and then hits enter and then again enter jfkdjf in my database i been stored as abscbabc twoboxes (new line) and then jfdkf and then sometime later i am taking that plan name and sending it as a subject to an email but since it has a new line character in that field.. i get an error..
 
so how can escape the new line character..
thanks
Karen

View 6 Replies View Related

Quoted Field And Escape Character Issue

Nov 8, 2006

I am attempting to import a flat file and have come accross and issue that I do not know how to fix in SSIS. The issue is that some of the text fields use quoted identifiers. This is not an issue in itself. The problem is they also use quotes as escape character if quotes are on the field.

So I see instances of "" because inside the quoted field is a quote. How do i specify an escape character?

View 1 Replies View Related

C# UI Escape Character Problem To Execute Command Line

Aug 3, 2006



Hi!

Thanks For your reply!

but this is very urgent please help!!!!!!!

I need one more help in this issue. what if i do not need any "

for e.g: i am trying to set conn string and varaible value

jobCommand = new SqlCommand("xp_cmdshell 'dtexec /f "" + path + "" /Conn "" + Packconn + "" "" + connect + "" '",cconn);

i am getting some value like this :

CommandText "xp_cmdshell 'dtexec /f "D:\SSISProject\Integration Services Project1\ArchiveMainMultiTables.dtsx" /Conn "SE413695\AASQL2005.TestDB;" "Provider=SQLNCLI.1;Data Source=SE413695\AASQL2005;Initial Catalog=TestDB;Provider=SQLNCLI.1;Integrated Security=SSPI;" '" string


I do not need the highlighted escape characters in it. what should i do??????

i need some thing like this :

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

Thanks,

Jas

View 2 Replies View Related

Slash In Expressions

Jan 14, 2008



Hi,

I have the following expression:

@[User::varLogFolder] +"\"+ "CollectTrnsRxaFecPagLog.txt"

but when I evaluated it I get:

\testteamserverMigrationLog\CollectTrnsRxaFecPagLog.txt

As you can see I´m trying to create a folder but it keeps the double slash, how can I fix it?

thanks.

well the real expression is:

@[User::varLogFolder] +"\"+ @[System:ackageName] +"\"+replace(replace(@[User::varFilesCollect],"\","" ),".","")+"\"+"CollectTrnsRxaFecPagLog.txt"

and the error is because:

[CollectTrnsRxaFecPagLog [4712]] Information: The processing of file "\testteamserverMigracionLog\PCKG_BH_COLLECT estteamservermigraciondatamcli010001rxaCollectTrnsRxaFecPagLog.txt" has started.

the yellow characters are the conflict!!

View 3 Replies View Related

Cast/Conv Expression Remove The Slash : 02/02/2008

Mar 27, 2008

Hi, I need help please.

I have text source & i need to write it to table field being an integer.
I complains about the column, so i added a derived column but I am clueless in the expression:

Source from text: 02/02/2008
Derived column expression to output: 20080202 in a int datatype

I need the expression to do it.

Please Assist!

Regards

View 13 Replies View Related

String Variable With Embedded Quotes Getting Changed To Slash/quote

Jul 9, 2007

I have a Foreach loop that dynamically builds a query that gets submitted to a Progress 9.1d database. The "SELECT" portion of the query is static - the WHERE clause is built dynamically each pass through the for each loop. The vast majority of the columns have a dash ("-") in their names, so the query passed to progress has to have double quotes surrounding the column names. Not a big deal you would think. If I am retrieving 3 columns, my string would look like "SELECT ""manager-name"", ''"employee-name"", ""date-of-hire"" FROM PUB.EmployeeTable" - with the columns requiring quoted identifiers escaped with double quotes. My script task adds some additional info to the WHERE clause based on other conditions. Once my script task has built the query string, it assigns that string value to my Dts.Variables("SqlString") variable.



I can put a MsgBox() call in the Script task to display my query once it has been built (displaying Dts.Variables("SqlString").Value) - and it looks fine. Using the above example, it would simply be: SELECT "manager-name", "employee-name", "date-of-hire" FROM PUB.EmployeeTable.



So - My foreach loop is set up so that the query command is pulled from my Dts.Variables("SqlString") variable. It fails anytime my query has a column that requires quotes around it. I was confused, since I could take the exact query string displayed by my test MsgBox() and validate it's syntax against our Progress database (and even run it) and it worked fine.



So - I then inserted a breakpoint to break on PreExecute for the DataReader task (next task after Scrip task) to view the value of the Dts.Variables("SqlString") variable just before it gets assigned to the DataReader's Sql Command property. That's when I noticed that the value of the Dts.Variables("SqlString") in the Watch window actually showed that the "double" double quotes I had entered in the SELECT clause (to escape to one double quote) were being replaced with " (slash quote). SO - in the Watch window, my Dts.Variables("SqlString").Value reads as follows:

SELECT "manager-name", "employee-name","date-of-hire" FROM PUB.EmployeeTable.



Obviously, that query is not going to fly via SQL-92/ODBC connection to our Progress database. I've tried everything I can think of - even trying to replace "" with "" in the Foreach expression editor where the Sql Command of the data reader gets assigned. I'm at a total loss. Why would SSIS plug in what looks like C# character escaping syntax when all the expressions are supposed to be VB.NET? I've already successfully run several packages that query our Progress databases that do NOT use the double quotes in the SELECT clause and they work fine. Does anyone have any ideas??

View 3 Replies View Related

Forward Dependency

Jun 5, 2007

I am attempting to duplicate a nifty feature that one of my colleagues used:



We have parameters where a user can select a client or an individual account. There are available values for each parameter from two queries. I tried to have the available values in the account list dependent on the user's selection in the client list by passing the client parameter's value to the query for the account data set and using it in a where clause, but I get a "forward dependency" error.



The weird thing is that my colleague tried the same strategy and it worked. We together tried to set my report up the same as his, but cannot find why his works and mine doesn't. Any ideas?



His report works when deployed from my machine, so there must be something in the actual report that is different...

View 1 Replies View Related

Store And Forward Via OLE-DB?

Apr 3, 2008

Hello all - I am trying to come up with a reasonable solution to an intermittent network. Specifically, I have a SQL Server 2005 installation that receives data from a client across a wireless network via OLE-DB. There are times when the network connection may not be available, and I would like to buffer the transaction (somehow!) locally, and then have it passed to the database upon re-establishing connectivity.


Any suggestions or recommendations would be greatly appreciated!


Thanks!

View 1 Replies View Related

T-SQL (SS2K8) :: Find String Before Character When Character Appears Multiple Times

May 17, 2015

I have a table that contains file paths as

ServernamefolderAfilenameA
ServernameFolderBFilenameB

and I need a query to return

ServernamefolderA
ServernameFolderB

I tried

SELECT DISTINCT left(Source, charindex('', Source)- 0) AS String
FROM Table

But that removes everything after the first and I need it to return all data before the last

View 5 Replies View Related

Going Back Or Forward 1 Record

Jul 12, 2004

Does anyone know how to go back 1 record?

I know how to go forward 1 record:


Code:

SELECT TOP 1 *
FROM MyTable
WHERE [id] > 27
ORDER BY [id]



This will select the record with the id 28, if id 28 does not exist, then it will select the next available id.

however, then I try:


Code:

SELECT TOP 1 *
FROM MyTable
WHERE [id] < 27
ORDER BY [id]



It goes to the very first record in the table, becuase it selecting the TOP 1 record, How do I only go back 1 record, eg. id 26.

View 2 Replies View Related

Forward Looking Thought: Raw Files

Oct 6, 2006

I assume that MS has a directive never to change the format of SSIS raw files...

However, what I'd like to know is that when I'm planning long-term systems where I've got backups of data (staging, logging, whatever) using raw files, can I be assured that future versions of SSIS will be able to read those raw files?

I assume a certain level of backwards compatibility, however, I'm just curious if I should think about building processes into my projects that would factor that in and rebuild raw files everytime a new/major release of SSIS comes out.

Phil

View 5 Replies View Related

T-SQL (SS2K8) :: Replace Multiple Occurrences Of Same Character With Single Character

Aug 6, 2015

I have the following scenario, The contents of main file are like :

ServerCentral|||||forum|||||||||||||||is||||||the||best
so||||||be|||||on||||||||||||||||||||||||||||||||||||||||||||it

And I need the output in the following form:

ServerCentral=forum=is=the=best
so=be=on=it

The logic being that multiple and consecutive occurrences of the special character, here - pipe , should be replaced by a single special character.

View 5 Replies View Related

Forward All SQL Traffic Through A Single Point.

Jun 15, 2007

Hello, we are trying to find a way to send all SQL traffic from multiple machines in a DMZ trough only one point. This way the firewall doesn't need to be opened to each and every machine.

This may be a simple question but I have never done it before. Any recommendations?

Thanks in advance.

View 4 Replies View Related

How Do You Know What Transation ID To Play Forward After Restore?

Jul 20, 2005

When you restore a backup from a point in time, how do you then knowwhich transaction ID to start with when you want to roll forward fromthat point in time to another point in time?

View 1 Replies View Related

Error: Forward Dependencies Are Not Valid

Jan 12, 2007

I want to set a Report Parameter on a field. The Report Parameter is called 'filter'. In the statement I put the Report Parameter in the WHERE-part:
WHERE ([DatabaseName$TableName].[FieldName] = @filter). After this I set the 'Available values' on the Report Parameter in the lay-out to Non-queried.
When the report is running, no problems.

But.....

Now I want to set 'Available values' on 'From Query' and refer to the data set, so the user can choose on which value he want to filter. But now, after running the preview the following error displays:
Error 1 [rsInvalidReportParameterDependency] The report parameter €˜filter€™ has a DefaultValue or a ValidValue that depends on the report parameter €œfilter€?. Forward dependencies are not valid.

Why can't I set the Report Parameter to 'From Query'? Anyone any suggestions???

(you can see the rest of my statement here: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1098540&SiteID=1)

Thx a lot of helping me out with this topic.....

View 8 Replies View Related

Select Part Of Character String Based On A Character

Apr 15, 2004

I have data in a column that starts with 1-4 characters followed by a dash then followed by an number of characters (ex: EU-Surgery).

How do I select everything to the right of the dash when the number of characters to the left of the dash varies?

View 3 Replies View Related

SQL2000 - Forward Events To Named Instance?

Jun 4, 2007

I am trying to get Event Forwarding to work between two SQL 2000 servers. Both are running SQL 2000 Enterprise SP4 and Windows 2003 Enterprise SP2. I am managing them from my local desktop running XP. I have both servers registered in Enterprise Mgr.



<Server XInstance Z> (named instance) is the server on which I have a MAPI client installed and configured along with SQL Operators and SQL Alerts. <Server Y> (default instance) is the server from which I want to forward events > Sev 17.



<Server XInstance Z> is set up to receive error msgs 9002 and 1105 and email operators that either a log is out of space or a data file is out of space. It has been verified on <Server XInstance Z> that it will send locally generated errors to the operators correctly.



<Server Y> is set to forward to <Server XInstance Z> any event that is sev 17 or greater. However, when I simulate an 1105 on <Server Y> I get this error msg in its Application Event log:



Event Type: Error
Event Source: SQLSERVERAGENT
Event Category: Alert Engine
Event ID: 316
Date: 6/4/2007
Time: 11:37:55 AM
User: N/A
Computer: <Server Y>
Description:
Unable to open the eventlog on forwarding server '<Server XInstance Z>' (reason: Sockets error 11004).

For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.



I figured this may be due to the fact that SQLAgent is trying to forward a Windows event to another Windows server running SQL but there is no default instance of SQL Server. So I thought I would add a bogus entry to my Enterprise Manager that was just <Server X> with no instance name. Obviously, EM failed to connect but asked if I wanted to register anyway. I chose Yes. So I was then able to change the server in Forward To on <Server Y> to <Server X>.



That actually worked and it began forwarding error messages to to <Server X>. But the error messages are going to the System error log as opposed to the Application error log where I need for them to go. This is the message from the System error log on <Server X>:



Event Type: Error
Event Source: MSSQLSERVER
Event Category: Disk
Event ID: 17052
Date: 6/4/2007
Time: 11:32:40 AM
User: N/A
Computer: <Server X>
Description:
The description for Event ID ( 17052 ) in Source ( MSSQLSERVER ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: Error: 1105, Severity: 17, State: 2
Could not allocate space for object 'MyTestTable' in database 'Northwind' because the 'PRIMARY' filegroup is full..
Data:
0000: 51 04 00 00 11 00 00 00 Q.......
0008: 0c 00 00 00 43 00 48 00 ....C.H.
0010: 41 00 52 00 4c 00 45 00 A.R.L.E.
0018: 53 00 53 00 2d 00 58 00 S.S.-.X.
0020: 50 00 00 00 0a 00 00 00 P.......
0028: 48 00 4f 00 55 00 34 00 H.O.U.4.
0030: 51 00 31 00 31 00 30 00 Q.1.1.0.
0038: 35 00 00 00 5...



I'm stuck here now. Anyone else run into this problem?

View 1 Replies View Related

ESCAPE Clause

Dec 26, 2007

 SELECT     ID, Firstname, LastnameFROM         Table_1WHERE     (Firstname LIKE '2-%%' ESCAPE '-')
Firstname
2%
267585
why statement above correct work but statement down correct do not work.
 SELECT     ID, Firstname, LastnameFROM         Table_1WHERE     (Firstname LIKE '2-%' ESCAPE '-')
Firstname
null
 
by mohsen

View 2 Replies View Related

ESCAPE Clause

Dec 27, 2007

SELECT ID, Firstname, Lastname FROM Table_1
 WHERE (Firstname LIKE '2-%%' ESCAPE '-')                                                             
ID     FIRSTNAME      LASTNAME
2       2%                  mohsen
 why statement above correct work but statement down correct do not work.                       table
                                                                                                                                    ID          FIRSTNAME    LASTNAME     
SELECT ID, Firstname, Lastname FROM Table_1                                                             1             mohsen         nafisi
   WHERE (Firstname LIKE '2-%' ESCAPE '-')                                                                   2               2%              mohsen
                                                                                                                                     3              25467          89
ID   FIRSTNAME      LASTNAME
NULL    NULL          NULL
 

View 1 Replies View Related

ESCAPE Clause

Dec 28, 2007

explain ESCAPE clause in LIKE clause with example.
no MSDN and Link.
by mohsen

View 2 Replies View Related

ESCAPE Clause

Dec 28, 2007

explain ESCAPE clause in LIKE clause with example.

by mohsen

View 1 Replies View Related

Way To Escape From CURSOR

May 3, 2002

I am probably a bit of dumb programmer but I am trying to get away from using cursors in my SQL stored procedures. I probably have my VB program code set in my mind but what is the alternative of doing something like this in T-SQL:

do while not recordset.eof
if condition is ok then
update blah blah blah set something = recordset("field")
end if
recordset.movenext
Loop

Can someone give me an example in T-SQl which can achieve the same thing? (Apart from calling SQL stored procedure using ADO within VB?)

Thanks

View 1 Replies View Related

Escape Sequence

Sep 1, 2004

Hi,
I have a question with this query -
SELECT * FROM table1 WHERE column1 = 'T_C_%';

This query returns rows where column1 = "T_Care", "T_CRP" etc etc, whereas I was expecting only rows where column1 = "T_C_Tail", "T_C_Head"

However, when I use an escape character(/), the results are more in the lines of the expected results.

Can somebody explain this?
cheers/- Pradeep

View 2 Replies View Related

Escape Characters

Sep 6, 2005

What should one pass as a field value into a table in the insertstatement if the value contained a percentage symbol (%) or theasterisk symbol (*), since both of these have special wildcardmeanings. What if I want to pass the special meanings and pass them asliterals? Is there any escape character that I must use? I am usingADO.NET v1.1 of the framework with VB.NET. The database is MicrosoftSQL Server 2000.

View 1 Replies View Related

Escape Characters

Sep 26, 2006

Hi,

I need to insert this command into a table, but I can't because.

insert XXX

set column1 = isnull(Title,'') +

case when (case when title is null then 1 else 0 end) = 1 then '' else ' ' end

+ isnull(Last_name,'') +

case when (case when First_name is null then 1 else 0 end) = 1 then '' else ' ' end

+ isnull(First_name,'') +

case when (case when Middle_initial is null then 1 else 0 end)= 1 then '' else ' ' +

isnull(Middle_initial,'') END

I don't know how to use escape sequence, I need insert just once



thanks

View 4 Replies View Related

Escape Characters

Sep 26, 2006

Hi,

I need to insert this command into a table, but I can't because.

insert XXX

set column1 = isnull(Title,'') +

case when (case when title is null then 1 else 0 end) = 1 then '' else ' ' end

+ isnull(Last_name,'') +

case when (case when First_name is null then 1 else 0 end) = 1 then '' else ' ' end

+ isnull(First_name,'') +

case when (case when Middle_initial is null then 1 else 0 end)= 1 then '' else ' ' +

isnull(Middle_initial,'') END

I don't know how to use escape sequence, I need insert just once



thanks

View 4 Replies View Related

Return Left-most Character From 8 Character String

Oct 1, 2014

I'd like to return the left-most character from an 8 character string & the third from the left character too.

Like this ABC00123 returns AC

$query = "SELECT LEFT(uninum,3), RIGHT(uninum,5), clmarea, Date FROM tblunimov";
$result = mysql_query($query) or die(mysql_error());

echo "<div class='tblstyle1'>";
echo "<table class='tblstyle1'>";
echo "<tr><th>ini</th><th>item</th><th>area</th><th>date</th></tr>";
while($row = mysql_fetch_array($result)){

[Code] ....

View 5 Replies View Related

Tables For Cumulative Tally And Carrying Balances Forward?

Nov 14, 2014

I have a client that I provide financial modelling services to (using Excel). They have a requirement to start capturing subscriber movements in their SQL DB. how the table should be set-up and how to extract the necessary movements report. This is largely so that I may include these components in some of the financial models that I am working on.

Subscribers are reported as follows:

Opening subs (the prior periods closing balance; or the sum of new sales at point of 1st entry)

+ New Sales (new subs)

+ Upgrades (movement from a lower product package to the associated package)

- Downgrades (movement to a lower product package from the associated package)

- Churn (subscriber losses)

Closing Balance

All transactions are captured against a specific product package, on a specific date (ymd), and for an associated platform (e.g. digital TV, broadband TV, cable TV).

I believe we only need to capture new sales, upgrades, downgrades and churn. And then used a SP to compile the movements behaviour as described above.

So perhaps the table would appear as follows:

Platform
Package
Date
Movement
Value

DTV
PROD 1
2014-11-02
New Sales
8

DTV
PROD 1
2014-11-02
Upgrades
1

[code]....

So I am assuming that given a table such as the above, we could write a SP to produce an output such as (note, below looks at monthly total so will not agree back to sample above which contains only 2 days):

Platform
Package
Movement
September
October
November

DTV
PROD 1
OPEN
600
676
776

DTV
PROD 1
New Sales
92
106
88

[code]....

how one is best to accumulate the balances given that the open date for any given reporting period is in fact an accumulation of all balances since day 1.

How does one typically capture this type of thing in SQL?

View 4 Replies View Related

T-SQL (SS2K8) :: Carry Forward Values From Previous Rows

Mar 23, 2014

I am working on a rewards program and I have a table whenever customer completes a trip, his total fare,business points earned for that particular trip and respective Promotional points gets inserted.

Now I have a scenario whenever customer business points accumulates to 10 then need to award 3 promotional points.

If Business Points=14 for a single trip then for the first 10 points respective Promo points will be awarded and the remaining 4 points should get carry forward for the next trip and this 4 points should get accumulated with the next trip Business Points and so on.

Basically need to check for every 10 Business points accumulated award some Promo points and carry forward remaining points.

Here is the sample table structure and data :

CREATE TABLE [dbo].[tblRedeems]
(
[Mobileno] [varchar](50) NOT NULL,
[TripNo] [int] NOT NULL,
[CustomerName] [varchar](50) NULL,
[TripEndTime] DATETIME NOT NULL,

[Code] .....

View 5 Replies View Related







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