Help With Query (control Structure + Regex)

Mar 10, 2008

Hi,

I have the following query I am bulding, its returning the desired results I am just really bad at control statements in TSQL.

What I want to do is dynamically pass the "and landingPage like '/products%' to the SPROC. If I pass nothing this part of the query is not added.

Also, I am wondering how difficult it would be to pass some RegEx into the "landingpage like '%asdf' " part of the query ?
I have started reading some articles but it seems pretty complicated. I am running sql2005 so I am clear on that part.

Any help is much appreicated!!

Thanks again,
mike123




CREATE PROCEDURE [dbo].[select_google_referrers_groupByQueryDate_OrderByQueryDate]

(
@numDays int,
@landingPage varchar(50) = NULL
)

AS SET NOCOUNT ON

SELECT CONVERT(varchar(10),GO.queryDate,112) as referDate,

COUNT(GO.queryID) AS TotalReferrers FROM tblgoogle_referrerDetails GO

WHERE DateDiff(dd, GO.queryDate, GetDate()) < @numDays and landingpage like '/products%'

GROUP BY CONVERT(varchar(10),GO.queryDate,112)

ORDER BY referDate DESC
GO

View 11 Replies


ADVERTISEMENT

SSIS VSS Source Control Structure

Apr 22, 2007

I have all the config files for my various packages in a folder call configs. It seems that I cannot add folders to the SSIS solution. I can add config files, but they get copied into the root folder, which breaks the directory structure that I have.

Am I missing something? Is there a recommended to manage config files, and other external files used by the SSIS package, in SourceSafe and in the SSIS solution? Thank you.

View 1 Replies View Related

Analysis :: How To Structure Source Control Folders In Team Foundation Server

Jun 11, 2015

How to integrate current artifacts with TFS ?

For example : We have multiple applications X, Y, Z  each has  its own SSIS solution , SQL Script, MSTR report and documentation.

We move code from Dev to Test and then to PROD

How to structure the folders which will be easy to manage and easy to release ?

View 3 Replies View Related

Access Control List (structure) Invalid - Updating Virtual Directory Information

Sep 26, 2005

Hi,I've just installed SQL server and then IIS and SQLCE tools.I created a virtual directory and was trying to update the NTFSpermissions from SQLServer Connectivity management when i got thefollowing error - Access Control List (structure) invalid.Has anyone come across this and if so, what did u do to fix it.ThanksLyn

View 2 Replies View Related

Mdx Using Regex For Name

May 27, 2008



I want to write a query which does something like 'get sales data in 2006 for products with names starting with "bond" '. My problem is writing mdx which can filter products names which contain certain word in a certain format and also output the matched product name.

In MDX, is it possible to filter dimension members using regex? If regex support is not available, is there sql 'like' operator in mdx.

Thanks,
Chandra.

View 3 Replies View Related

RegEx Problem

Apr 7, 2006

Can anyone tell me what is wrong with my regex plz:

Code:

Like "[A-Z][A-Z][0-9][0-9][0-9][A-Z][A-Z]" Or " [A-Z][A-Z][0-9][0-9][A-Z][A-Z]"



The Or condition seems to bust the whole thing, I tried And too but no go.
This works though:

Code:

Like "[A-Z][A-Z][0-9][0-9][0-9][A-Z][A-Z]"

View 1 Replies View Related

SQL Regex Replace How-To?

Feb 21, 2007

Anyone find any good readings on how to do a regular expression to replace text?

Basically trying to figure out how to replace text in columns (replace quotes " with the word inches. so 12" will be 12 inches)

View 5 Replies View Related

Regex In Mssql ?

Nov 20, 2007

hello people,
I have a table with some field named 'f1', the filed contains string like this:

1:3-12/23.2:3-23/12.78:4-12/11
and so on with the same format...

I need to write some sql query that extracts all the first one or two numbers that appears before the ':' (all the red numbers in the example above). I don't mind if I get the result as a set of rows or a string that contains all the (red) numbers.
is it possible with mssql?

thanks.

View 2 Replies View Related

Regex Task?

Apr 13, 2007

I have a field in my table that in my transformation I like to replace all characters except (letters,digits,space and hyphen) with "". Is it possible to do that in SSIS package and possibly though regex?



Thanks for your time in advance.



View 6 Replies View Related

Regex For Dtexec /ConsoleLog

Mar 12, 2008

This is a long shot but I'm hoping someone from the SSIS team can help.

Do you happen to have a regular expression that checks validity of the value supplied to the /ConsoleLog option of dtexec?

I suspect the answer is no but I thought I'd ask anyway. I figure you guys must have had to solve this at some point when you originally wrote dtexec.

Thanls
Jamie

[Microsoft follow-up]

View 3 Replies View Related

GPL RegEx Source Component

Apr 6, 2006

While working on a recent project, I needed to import a number of old mainframe generated text reports. Since they didn't work on the one-record/one-row construct, the Flat File Source won't work.

So, I created a custom component that allows you to specify a Regular Expression pattern, and it will parse a text file and return columns. Each capture in the RegEx pattern is returned as a column, and you can also specify column names in the regex with the standard (?<colname>) syntax. The code is fairly basic really, but if you are comfortable with regular expression syntax, it can handle a huge variety of unusual text file formats. It also includes a UI editor for the RegEx pattern property that will allow you to test the pattern against a sample text file; it will highlight each row in blue and each column in green (see screenshot)

Since this might have applications for other folks, I added it to SourceForge under GPL. So if you might find that functionality useful, please check out http://sourceforge.net/projects/textregexsource/ and send me some feedback. There isn't much there yet, so check out the screenshots/news/release notes for the basics.

If there is demand, I'll create a more robust install package and documentation. Also looking for feature suggestions.

Cheers...Geof

View 2 Replies View Related

How To Structure Query

Nov 22, 2006

I need to count distinct postalcodes from the customer table and then next to it put the number of times that postalcode was used and the state for the zipcode.Example output:85007 / 12 / AZ90210 / 4 / CAThis is about as far as my knowledge takes me:select count(distinct postalcode) from customersAny help generating this query would be greatly appreciated.

thanks!

View 5 Replies View Related

Regex Parser Text Field

Jul 20, 2005

I have a text field that contains abstract information formated inHTML, I'd like strip the HTML and insert the data in another Textfield within a DTS package. Is this possible?any suggestions would be appreciatedMatt

View 1 Replies View Related

Query For Table Structure

Dec 16, 2004

Hi,
I'm looking for some code that will pull back a list all tables in a database that meet a certain requirement - in this case all tables that have an identity column.

Can anyone point me in the right direction?

Cheers
Greg

View 1 Replies View Related

Recursive Query Without Self-Referencing Structure

Sep 13, 2007

I need a statement that can return a hierarchy of folders. There are a number of good articles out there describing how to do this in SQL 2005 with a Common Table Expression (CTE) that references itself under a UNION ALL. Yet every example I come across involves a self-referencing table. Unfortunately the architect of my project did not use that simple structure. Instead, we have a Folder table and Folder Properties table. Creating a child Folder involves adding a row in the Properties table that links to a parent. Here's the statement I came up with:

WITH Folders (ID, ParentID, FolderName, FolderDepth)AS ( SELECT FOLDER_ID, NULL, FOLDER_NAME, 0 FROM ZZ_FOLDER WHERE FOLDER_ID = 1 UNION ALL SELECT F.FOLDER_ID, Folders.ID, F.FOLDER_NAME, Folders.FolderDepth + 1 FROM ZZ_FOLDER F INNER JOIN ZZ_FOLDER_PROP FP ON FP.FPROP_FOLDER_ID = F.FOLDER_ID WHERE FP.FPROP_LINK_ID = Folders.ID )SELECT * FROM Folders

The initial statement brings back the top of the folder structure. The recursive statement brings back Folder rows that have an entry in their Property rows for the parent. Yet when I try to execute this, I get:

Msg 4104, Level 16, State 1, Line 1The multi-part identifier "Folders.ID" could not be bound.Msg 4104, Level 16, State 1, Line 1The multi-part identifier "Folders.ID" could not be bound.Msg 4104, Level 16, State 1, Line 1The multi-part identifier "Folders.FolderDepth" could not be bound.

It sounds like all the recursive references to the CTE are unavailable. What am I doing wrong? Would welcome any suggestions, too. I realize this isn't a T-SQL specific question, more SQL in general, but I didn't see a more relevant forum. What follows are some tables/data to run the above statement against.

-- Create Folder TablesCREATE TABLE ZZ_FOLDER ( FOLDER_ID INTEGER NOT NULL PRIMARY KEY, FOLDER_NAME VARCHAR(50))CREATE TABLE ZZ_FOLDER_PROP ( FPROP_ID INTEGER NOT NULL PRIMARY KEY, FPROP_FOLDER_ID INTEGER NOT NULL, FPROP_LINK_TYPE VARCHAR(50), FPROP_LINK_ID INTEGER NOT NULL)GO-- Populate Folder TablesINSERT INTO ZZ_FOLDER VALUES (1, 'Top Level')INSERT INTO ZZ_FOLDER VALUES (2, 'Second Level A')INSERT INTO ZZ_FOLDER VALUES (3, 'Second Level B')INSERT INTO ZZ_FOLDER VALUES (4, 'Second Level C')INSERT INTO ZZ_FOLDER VALUES (5, 'Third Level A1')INSERT INTO ZZ_FOLDER VALUES (6, 'Third Level A2')INSERT INTO ZZ_FOLDER VALUES (7, 'Third Level A3')INSERT INTO ZZ_FOLDER VALUES (8, 'Third Level B1')INSERT INTO ZZ_FOLDER VALUES (9, 'Third Level C1')INSERT INTO ZZ_FOLDER VALUES (10, 'Third Level C2')INSERT INTO ZZ_FOLDER VALUES (11, 'Fourth Level A3A')INSERT INTO ZZ_FOLDER_PROP VALUES (1, 2, 'Folder', 1)INSERT INTO ZZ_FOLDER_PROP VALUES (2, 3, 'Folder', 1)INSERT INTO ZZ_FOLDER_PROP VALUES (3, 4, 'Folder', 1)INSERT INTO ZZ_FOLDER_PROP VALUES (4, 5, 'Folder', 2)INSERT INTO ZZ_FOLDER_PROP VALUES (5, 6, 'Folder', 2)INSERT INTO ZZ_FOLDER_PROP VALUES (6, 7, 'Folder', 2)INSERT INTO ZZ_FOLDER_PROP VALUES (7, 8, 'Folder', 3)INSERT INTO ZZ_FOLDER_PROP VALUES (8, 9, 'Folder', 4)INSERT INTO ZZ_FOLDER_PROP VALUES (9, 10, 'Folder', 4)INSERT INTO ZZ_FOLDER_PROP VALUES (10, 11, 'Folder', 7)GO/*Top Level Second Level A Third Level A1 Third Level A2 Third Level A3 Fourth Level A3A Second Level B Third Level B1 Second Level C Third Level C1 Third Level C2*/

View 3 Replies View Related

Structure Or Syntax For Query / Filter

Apr 23, 2015

I need to find a 12-digit number in a column called "SequenceNumTxt", in a VERY long table.I can query the first n lines but need to add something like "WHERE [SequenceNumTxt]="123412341234".The above does not work, gives me a syntax error; what am I doing wrong?

View 7 Replies View Related

Transact SQL :: How To Make Phone Number In A Regex Pattern

Oct 27, 2015

I am learning the string functions and the database that I'm using is AdventureWorks2012.However ,while practicing I was just trying to hide the phone number with '*' mark,but not getting the desired result.So the code is.............

SELECT
             PhoneNumber,  (SUBSTRING(PhoneNumber,1,2)+REPLICATE('*',8)+
             SUBSTRING(PhoneNumber,CHARINDEX('[0-9][0-9]{1,2}',PhoneNumber),LEN('-555-01')))AS[PhoneNumber]
 FROM
             Person.PersonPhone

[code]....

View 6 Replies View Related

Simple Text Processing E.g. Regex Search And Replace

Aug 8, 2006

I've got an nvarchar(max) column that I need to transform with some simple text processing: insert some markup at the very beginning, and insert some markup just before a particular regular expression is matched (or at the end, if no match is found).

Since the SSIS expression language doesn't support anything like this, is a Script Component the only way to go? Does Visual Basic .NET provide regular expression matching?

Thanks!

View 13 Replies View Related

Hierarchy Query To Form Organization Structure

Jun 8, 2014

I need to write a sql that generate the hierarchy in an organization.Below an example

emplid empname supervisor_id superv_name
1 subu null null
2 vid 1 sub
3 ram 4 satis
4 satis 2 vid

i need an output to this query as below and also one important the supervisor ie supervisor_id and name is null is the top level,every employee also has to report to him and also to his all above supervisors.whoever joinng new to org the hierachy should be follwed

empid empname supervisor_id superv_name
3 ram 4 satis
4 satis 2 vid
2 vid 1 subu
4 satis 1 subu
3 ram 1 subu
3 ram 2 vid
5 kumar 1 subu
5 kumar 4 satis
5 kumar 2 vid
1 subu null null

View 1 Replies View Related

Any Structure On Sql Server Like WITH ... SELECT Structure On DB2

Jul 20, 2005

Hi,I'm using DB2 UDB 7.2.Also I'm doing some tests on SQL Server 2000 for some statements touse efectively.I didn't find any solution on Sql Server about WITH ... SELECTstructure of DB2.Is there any basic structure on Sql Server like WITH ... SELECTstructure?A Sample statement for WITH ... SELECT on DB2 like belowWITHtotals (code, amount)AS (SELECT code, SUM(amount) FROM trans1 GROUP BY codeUNION ALLSELECT code, SUM(amount) FROM trans2 GROUP BY code)SELECTcode, SUM(amount)FROM totalsGROUP BY code.............................Note: 'creating temp table and using it' maybe a solution.However i need to know the definition of the result set of Unionclause. I don't want to use this way.CREATE TABLE #totals (codechar(10), amount dec(15))GOINSERT INTO #totalsSELECT code, SUM(amount) FROM trans1 GROUP BY codeUNION ALLSELECT code, SUM(amount) FROM trans2 GROUP BY codeGOSELECT code, sum(amount) FROM #totals GROUP BY codeGOAny help would be appreciatedThanks in advanceMemduh

View 3 Replies View Related

Query That Varies According To Control Values

Mar 7, 2008

I have a query that varies depending on control values. For example, what comes after the SELECT, FROM, WHERE, or ORDER vary with what table they need to look in, how they want to look it up, what value they are looking for, and what order they want it displayed in. There are too many possibilities to write seperate queries for. The data found goes to a dataset and gets bound to a gridview. This is done inside a vb sub.
I tried to make a similar query in a selectcommand inside sqldatasource tags with if-then-elses in <%  %>s but got an error saying something like "constructs were not allowed inside tags."
How do you make a varying query as a selectcommand inside datasource tags?

View 4 Replies View Related

Issue With SSRS Report Exporting To Excel With The Matrix Control Inside The Table Control

Jan 27, 2008

Hi All,
I am placing a Matrix inside the table control for grouping requirements,but when we export the report to the Excel, the contents inside the table cell are ignored. Is there any way to get the full report exported, as per the Requirement.Please help me with this issue.

With Thanks
M.Mahendra

View 5 Replies View Related

Is It Possible To Embbed And Ocx Control On A Report Or Some Sort Of Interactive Control Like A Flash.ocx?

Oct 25, 2007

does any one have and example of how to embedd a flash swf file onto a report.??? Is it possable? any examples would be helpful.

View 1 Replies View Related

How To Get Number Of Records A Query Has Returned Using SqlDataSource Control?

May 17, 2007

Hi,
I'm using SqlDataSource control.
Is there a way to know how many records a query has returned?

View 3 Replies View Related

Query Date Range SQL Data Source Control

Jan 24, 2008

I have a DB with the folloing fields... ArticleID, ArticleTitle, PublishDate(DateTime Field), EndPublishDate(DateTime Field).... What I want to do is show in a list view only the articles where the date is on or after the PublishDate and before or on the EndPubishDate.
I thought I could simply do something like this
SELECT     ArticleTitle, PublishDate, PublishEndDate, PublishedFROM         UserArticlesWHERE     (Published = @Published) AND (PublishDate >= @PublishDate) AND (PublishEndDate <= @PublishEndDate)
 
Well I can't... can someone explain how I can do this please... I understand the the PublishDate and EndPublsihDate need a variable... The info is in the DB I just don't know how to do what I need to.
 
Thanks,
 

View 4 Replies View Related

Reporting Services From WebBrowser Control - Print = Unable To Load Client Print Control

Mar 20, 2007

UPDATE #2: When it said "Do you want to install Microsoft SQL Server" I said "yes" and that caused it to work. I exited and re-ran and now the print runs w/o the "install SQL Server" (If the prompt had said "Do you want to install the print dialog" we wouldn't be having this discussion...) 





UPDATE: After posting this i discovered that the same thing occurs when attempting to print the report direct from IE6: First a dialog pops up "Do you want to install this software?" Name: Microsoft SQL Server. When I click "Don't Install" I get the dialog "unable to load client print control." Since this happens direct from IE6 I suspect it's browser settings. I'll resume tomorrow and post a followup.







My WinForm C# app integrates Reporting Services by calling them from WebBrowser controls. The problem is attempts to print cause a dialog: "unable to load client print control."

I've read prior posts that say "enable Active-X in your browser" - I don't know how to do that from a WebBrowser control.



Any ideas how to support Reporting Services "Print" from within a WebBrowser control?

RELATED THREADS

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=332145&SiteID=1

http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=264478&SiteID=1

 

 

View 1 Replies View Related

Structure

Apr 18, 2004

let me explain my business rules first.

One company can have many site addresses;
One company can have many trades
And one trade can have many activities.

Ok seems very basic at this stage does'nt it, but if i give some data the complexity changes completly for example:

the trades are as follows:
TRADE TABLE
ID 1: DESC: Printing
ID 2: DESC: Artwork
ID 3: DESC: Photography
ID 4: DESC: Reprographics.

now in this case only the printing trade has activities:
TRADE ACTIVITIES TABLE
ID 1: DESC: Flexo
ID 2: DESC: Digital

So, in the above i am saying which ever company picks Printing as there trade, then they have the option of specifying which particular printing trade it is that they do.

Again simple enough by using one-to-many from the Trade Table to the Trade Activity table.

The problem is that not all trades have associated trade activities, for example the artwork trade activity is just artwork, but i need to be able to allow this to be so in the future.

When I try to create a view to select a particular company, with there associated trade and trade activity, I do not get any result at all because not all of the trade activities have any records assigned to them.

Please can anyone help.

I need to be able to pull back all companies with their associated trades and associated trade activities.

Cheers

Wayne

View 2 Replies View Related

DB Structure

Jan 11, 2006

Hi All

I want the structure of the entire database without the data from a database , I mean all the tables withouut the data ... Can i do that


Plz help

View 1 Replies View Related

DB Structure

Sep 28, 2006

As my learning process continues, I have found that Database structure is probably the most important & most difficutl part of development. Like database normallization etc.

How can I master database structure, ? but I want learning other than any database software like Access or SQL Server, I m looking for a generallized learning.

Will some1 give me assistance ...

View 3 Replies View Related

Exporting Db Structure

Feb 14, 2007

Hi,
is there a way of exporting a database structure and not the data in it?
Thanks.

View 5 Replies View Related

Database Structure

Sep 25, 2007

Hello I am a final year student and for my final year project I have decided to try and create a price comparison website due to the fact that i feel it would be a good project to work on and develop my technical skills in C# and microsoft sql server 2005, since these are mainly the two programs I would say i have more experience with. Basically I want to create a website such as www.pricerunner.com. At this point in time i have started playing around with how i feel the database will look, in terms of tables and columns, below is what i have produced;
Company                                
 Company_ID
Company_name
ADDRESS
 Website link
 contact 
Products
Product_ID
Product_name
Product_Category
Product_Price
 
I am now stuck as how i will link each company with a product bearing in mind a company will stock different categories of products, also do you think i need any more columns in any of the above tables, as well as am i missing out on anything, I am hoping someone with more knowlegde than myself can shed some knowledge on my problem, thank you.

View 5 Replies View Related

What And Why Is Better Table Structure?

Mar 7, 2008

Structure Number1 
Category: CategoryId(P.K.), UniqueName, CreatedDate, ModifiedDateCategoryNative: CategoryId(F.K.), LanguageId(F.K.), NativeName, Description, Importance, IsVisible, CreatedDate, ModifiedDate
Structure Number2 
Category: CategoryId(P.K.), UniqueName, CreatedDate, ModifiedDateCategoryNative: CategoryNativeId(P.K.), CategoryId(F.K.), LanguageId(F.K.), NativeName, Description, Importance, IsVisible, CreatedDate, ModifiedDate
Can anyone tell me that between above 2 structure what is better and why?
I just add CategoryNativeId(P.K.) in Number 2 structure.

View 2 Replies View Related

Table Structure

Mar 17, 2004

Dear all,

how can I use a store procedure to get the structure of a table like data type, length, description etc.

I have used sp_columns to get the information but it can't get the description of each field.

Thanks.

View 1 Replies View Related







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