Query For Generating A Tag Cloud

May 12, 2008

I've read some articles on generating tag clouds but so far only one actually showed a query. And the query was on a simple database with a few tags. In our database we have records that can have literally hundreds of unique tags. So, I'm wondering how to get a realistic result set of the top tags? I can't just do a group by and select the top 30 or 50 because that won't necessarily get me through the alphabet. I'd like to at least have as many letters from the alphabet in the tags as possible like (ant, cat, dog, horse, lion, seal, zebra) but if I do the top 30 it may cut off around the letter "c". Know what I mean? So, how can I generate an accurate tag cloud query that uses all available letters from the alphabet as starting letters for the tags? Thanks.

View 5 Replies


ADVERTISEMENT

Tag Cloud Tag Search

Apr 14, 2008

--set ANSI_NULLS ON
--set QUOTED_IDENTIFIER ON
--go
--
--
--ALTER PROC [dbo].[spEventTagCloud]
--as
--BEGIN
DECLARE @RECORDCOUNT INT;
DECLARE @SearchString varchar(2000);
DECLARE @QRY VARCHAR(2000);
DECLARE @SE VARCHAR(2000);
SELECT @RECORDCOUNT=COUNT(*) FROM TBEVENTS
DECLARE @ST INT;
SET @ST=1;
CREATE TABLE #TEMP2
(
MYTAGS VARCHAR(2000)
)
--CREATE TABLE #TEMP3
--(
-- TAGCOUNT INT
--)
CREATE TABLE #TEMP1
(
STR1 VARCHAR(2000)
)
WHILE @ST<@RECORDCOUNT
BEGIN
SET @QRY='SELECT TOP ' +CONVERT(VARCHAR,@ST)+' EVENTTAG FROM TBEVENTS'
--PRINT @QRY
INSERT INTO #TEMP1 EXEC (@QRY)
SELECT @SEARCHSTRING=STR1 FROM #TEMP1
SET @ST=@ST+1
declare @i1 int;
declare @i2 int;
declare @MatchType int ;
set @MatchType=0;
declare @Word varchar(100);
declare @Words table (Word varchar(100) not null);
declare @WordCount as integer;
DECLARE @TEMPWORD VARCHAR(2000);
begin
set nocount on
if (@MatchType != 2)
begin
set @SearchString = ' ' + @SearchString + ',';
--print 'Search String is :::: '+ @SearchString
set @i1 = 1;
while (@i1 != 0)
begin
set @i2=charindex(',', @SearchString, @i1+1)
--print @i1
if (@i2 != 0)
begin
set @Word = rtrim(ltrim(substring(@SearchString, @i1+1, @i2-@i1)))

SET @TEMPWORD=@WORD;
SET @TEMPWORD=REPLACE(@TEMPWORD,',','')
INSERT INTO #TEMP2 SELECT @TEMPWORD
--print 'Search WORD is :::: '+ @WORD

if @Word != '' insert into @Words select replace(@Word,',','')
end
set @i1 = @i2
end
end
else
insert into @Words select ltrim(rtrim(@SearchString))
set @WordCount = (select count(*) from @Words)
Declare @wordtemp varchar(2000);
set @wordtemp=@word
set @wordtemp=replace(@word,',','')
--INSERT INTO #TEMP2 SELECT @WORDtemp
END
END
SELECT mytags'Tag' , count(mytags)'Count' FROM #TEMP2 group by mytags ORDER BY [COUNT] DESC
--SELECT * FROM #TEMP1
DROP TABLE #TEMP1
DROP TABLE #TEMP2
--DROP TABLE #TEMP3
--END

________________________________
THE ABOVE EXAMPLE FOR A TAG CLOUD
MY TAGS ARE AS FOLLOW

EVENTTAG
_________
ASP.NET, C#, VB.NET
WELCOME TO ASP.NET
ASP.NET BOOKS,C#.NET BOOKS


I WOULD LIKE TO SELECT ALL COLUMNS FROM MY TABLE SEARCH TAG IS ASP.NET
THE FOLLOWING CODE WILL GENERATE AND SPLIT IT AS

TAG
____
ASP.NET
c#
VB.NET
WELCOME TO ASP.NET
ASP.NET BOOKS
C#.NET BOOKS

HOW TO SEARCH AN EXACT MATCH AS ASP.NET THE ONLY ONE ROW

View 2 Replies View Related

Difference Between Centralized Database And Cloud?

May 28, 2014

i know how centralized database works ,In a centralized system, I'll store it on one server. Then, I'll replicate that exact information to Server #2 for safekeeping.All the data's will be placed on root server,but i don't know diff between cloud and centralized database how they are working together.....

View 1 Replies View Related

Generating Auto Incrementing No Using SQL Query

Sep 22, 2004

Hi everyone,

I am having a table with which i generate a report. Now how to using a SQL query i can generate a auto incrementing no.

Say i am executing this query

SELECT NAME,AGE,ADDRESS FROM MEMBER which gives

NAME AGE ADDRESS
HOLYMAC 13 MALACCA
HOLYCOW 25 USA
HOLYGOD 55 LONDON


Now how can i make it come out like this

SNO NAME AGE ADDRESS
1HOLYMAC 13 MALACCA
2HOLYCOW 25 USA
3HOLYGOD 55 LONDON

See the first column is a auto incrementing number 1,2,3.


How can I write a SQL QUERY that outputs a auto incrementing number.


Thank you
Have nice day

View 2 Replies View Related

Generating Record ID In Your Select Query

Apr 11, 2008

If I wanted to run a query on any table and in the recordset that is returned have an 'id' field (or whatever) with the record id of that record, how would I do this?

I'm thinking something like

Select field1, field2, recordNumber // derived somehow - not an actual field
from table

where the result woule be:


field1 field2 1
field1 field2 2
field1 field2 3
field1 field2 4
field1 field2 5
...

View 6 Replies View Related

SQL Search :: Generating Dynamic Query

Jun 24, 2015

I have a table named "Persons"  which has the following columns [ Name ,Age, City]. I have a Windows app which has  3 textboxes for each column. My requirement is when I enter only name and enter the search button, I need result similar to this query.
     
select * from persons where name like '@tbname%'
when I enter only age and enter the search button, I need result similar to this query.
select * from persons where age =@tbage
when I enter name and city, I need result similar to this query.
select * from persons where name like '@tbname%' and city like '@tbcity%'

If I don't enter any fields and enter the serach button,  I need result similar to this query.

select * from persons for these 3 fields I might give any combination as above. But how can  I have a single query with all these combinations. I want a single query capable of doing this. I cannot have query like this, select * from persons where name like 'tbname%' and city like 'tbcity%' and age =@age

Because if I give only name,  city is considered as null nad age is considered as 0 and I get empty result. I cannot have Stored proc and I cannot do much in C# like using "selectqueryBuilder" etc. I need pure SQL query. 

View 4 Replies View Related

Generating A Datatable From Results Of A Dynamic Query?

Aug 25, 2004

I am developing a datagrid which will display a summary "report" of sales revenue grouped by a particular field. There will also be a drill-down on this field that will display in more detail the table of data that was used for the summary.

Because the user is selecting multiple criteria under which to run the search, I have created a dynamic query that gathers all the necessary data I need for both the drill down and the summary based on the variable parameters of the user. I've optimized the query that gathers the detailed data (taken from 7 tables) to execute far under a second.

So, that said, here's my question: It seems the most efficient way to get the summary data is to run it against the datatable (which gathers the detailed data) created by the dynamic query and just pass them both into a dataset. Can this be done? Originally, I was calling 2 separate sprocs in my application - one for the detailed data and another for the summary data using a "group by" on the table that was produced by the dynamic query (using "INTO TABLE" in the SELECT statement of the dynamic query). With this method, I received an access exception by asp.net. for the table created by the dynamic query so have dropped the "INTO TABLE", not to mention it increased the performance considerably NOT using the table.

Any suggestion on the most efficient/optimal method to use the data generated from the dynamic query sproc for the summary data? I am trying desparately to avoid running the dynamic query again just for the summary data.

I am a total newbie, so would appreciate any feedback. Also, would someone please tell me the datetime stamp function to print so that I can see how many milliseconds it takes to execute stored procedures?

TIA!

Sandy

View 1 Replies View Related

Transact SQL :: Generating XML (serialized) From Query Results

Aug 20, 2015

I didn't work with XML before and so I'm posting this question on how we can generate serialized XML. I have the following table -

DECLARE @Population TABLE (CountryId INT IDENTITY(1,1), CountryName VARCHAR(15), StateName VARCHAR(20), PopulationCount INT)
INSERT INTO @Population (CountryName, StateName, PopulationCount)
VALUES ('USA','California',300000),
('USA','Chicago',500000),
('Australia','Queensland',550000),

[Code] ....

Please note that I can have another country with 10 states or 30 states, so State Name is dynamic. Can this be done in SQL ? or we have to use .NET ?

SQLServer2014
-12.0.2000.8(X64)

View 6 Replies View Related

Cloud Of Confusion: Running SSIS Packages On 64 Bit SQL Server

Sep 25, 2007

It is clear to me that in order to be able to use certain SSIS components (for example the Excel jet provider) I must launch my packages using the 32bit DTEXEC located at Program Files (x86)Microsoft SQL Server90DTSBinn. However, when I do this it seems that there are other components of the package that no longer work as expected.

To test this I have created a simple package with two tasks (Run64BitRuntime is set to False):
1. Data flow task importing data from Excel
2. Execute SQL Task which does a simple select (select 1) from a Native OLE DB SQL data source (same SQL Server on which packages are stored). This task contains no input or output parameter.

When I try to execute the package using the 64bit DTEXEC, task 1 fails with the following error (as expected):
Code: 0xC0202009
Source: connection1 Connection manager "SourceConnectionExcel"
Description: SSIS Error Code DTS_E_OLEDBERROR. An OLE DB error has occurred. Error code: 0x80040154.
An OLE DB record is available. Source: "Microsoft OLE DB Service Components" Hresult: 0x80040154 Description: "Class not registered".

When I execute the package with the 32bit DTEXEC, task 2 fails with the following error
Code: 0xC002F210
Source: Execute SQL Task Execute SQL Task
Description: Executing the query "" failed with the following error: "Attempted to read or write protected memory. This is often an indication that other memory is corrupt.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.

Now here is the confusing part: When I change task 2 to use the .Net provider instead of the OLE DB the package works fine. According to the MS documentation, both of these providers are supported on 32 and 64 bit so am I missing something? One more thing to note: before I was able to use the 32 bit DTEXEC I had to re-register it as described in this KB article: http://support.microsoft.com/kb/919224

View 5 Replies View Related

Nested Select Query Generating Syntax Error

Jan 23, 2008

I hope I'm posting this in the correct forum. If not I apologize. I have a nested select query that I imported from Oracle:

Oracle Version:



Code Snippetselect avg(days) as days from (
select dm_number, max(dm_closedate) - max(comment_closed_date) as days from dm_data
where
dm_type = 'prime' and
dm_closedate <= '31-dec-2007' and
dm_closedate >= '1-dec-2007' and
program = 'aads'
group by dm_number)





SQL Version:



select round(abs(avg(days)), 0) as days from
(select dm.dm_number, abs(datediff(DAY,max(dm.dm_closedate), max(dm.comment_closed_date))) as days
from dm_data dm, ProgramXref px
where
px.Program_Name = 'aads'
and dm.Program_Id = px.Program_Id
and dm.dm_type = 'prime'
and dm.dm_closedate <= '31-dec-2007'
and dm.dm_closedate >= '1-dec-2007'
group by dm.dm_number)





In Oracle the query runs fine. In SQL I am getting a "Line 10: Incorrect syntax near ')'." error. If I run just the nested portion of the query, there are no errors. It only happens when the first query tries to query the nested query. Can anyone help me get the syntax correct?

Thanks,
Lee

View 4 Replies View Related

SQL Server Admin 2014 :: Maximum Size Of DB Hosted On Cloud Environment?

Feb 28, 2015

what is the maximum size of a DB hosted on SQL 2012 cloud environment?

View 3 Replies View Related

Reporting Services :: SSRS Word Cloud With Drill Down To Linked Report?

Jul 3, 2015

I have created a word cloud in SSRS 2008 using Jason Thomas's method but I would like to be able to add an action to click on a word to go to a another report using either the word or an ID integer. how to add an action to go to another report?

View 5 Replies View Related

SQL Server 2014 :: Stored Procedure - Add A Record To Local Database Executing In Cloud Environment

May 20, 2015

Is there a way using a stored procedure in a local database to add a record to a database executing in a cloud environment when both entities reside in different domains?

View 2 Replies View Related

Tag Search And Tag Cloud Search

Apr 14, 2008

--set ANSI_NULLS ON
--set QUOTED_IDENTIFIER ON
--go
--
--
--ALTER PROC [dbo].[spEventTagCloud]
--as
--BEGIN
DECLARE @RECORDCOUNT INT;
DECLARE @SearchString varchar(2000);
DECLARE @QRY VARCHAR(2000);
DECLARE @SE VARCHAR(2000);
SELECT @RECORDCOUNT=COUNT(*) FROM TBEVENTS
DECLARE @ST INT;
SET @ST=1;
CREATE TABLE #TEMP2
(
MYTAGS VARCHAR(2000)
)
--CREATE TABLE #TEMP3
--(
-- TAGCOUNT INT
--)
CREATE TABLE #TEMP1
(
STR1 VARCHAR(2000)
)
WHILE @ST<@RECORDCOUNT
BEGIN
SET @QRY='SELECT TOP ' +CONVERT(VARCHAR,@ST)+' EVENTTAG FROM TBEVENTS'
--PRINT @QRY
INSERT INTO #TEMP1 EXEC (@QRY)
SELECT @SEARCHSTRING=STR1 FROM #TEMP1
SET @ST=@ST+1
declare @i1 int;
declare @i2 int;
declare @MatchType int ;
set @MatchType=0;
declare @Word varchar(100);
declare @Words table (Word varchar(100) not null);
declare @WordCount as integer;
DECLARE @TEMPWORD VARCHAR(2000);
begin
set nocount on
if (@MatchType != 2)
begin
set @SearchString = ' ' + @SearchString + ',';
--print 'Search String is :::: '+ @SearchString
set @i1 = 1;
while (@i1 != 0)
begin
set @i2=charindex(',', @SearchString, @i1+1)
--print @i1
if (@i2 != 0)
begin
set @Word = rtrim(ltrim(substring(@SearchString, @i1+1, @i2-@i1)))

SET @TEMPWORD=@WORD;
SET @TEMPWORD=REPLACE(@TEMPWORD,',','')
INSERT INTO #TEMP2 SELECT @TEMPWORD
--print 'Search WORD is :::: '+ @WORD

if @Word != '' insert into @Words select replace(@Word,',','')
end
set @i1 = @i2
end
end
else
insert into @Words select ltrim(rtrim(@SearchString))
set @WordCount = (select count(*) from @Words)
Declare @wordtemp varchar(2000);
set @wordtemp=@word
set @wordtemp=replace(@word,',','')
--INSERT INTO #TEMP2 SELECT @WORDtemp
END
END
SELECT mytags'Tag' , count(mytags)'Count' FROM #TEMP2 group by mytags ORDER BY [COUNT] DESC
--SELECT * FROM #TEMP1
DROP TABLE #TEMP1
DROP TABLE #TEMP2
--DROP TABLE #TEMP3
--END

________________________________
THE ABOVE EXAMPLE FOR A TAG CLOUD
MY TAGS ARE AS FOLLOW

EVENTTAG
_________
ASP.NET, C#, VB.NET
WELCOME TO ASP.NET
ASP.NET BOOKS,C#.NET BOOKS


I WOULD LIKE TO SELECT ALL COLUMNS FROM MY TABLE SEARCH TAG IS ASP.NET
THE FOLLOWING CODE WILL GENERATE AND SPLIT IT AS

TAG
____
ASP.NET
c#
VB.NET
WELCOME TO ASP.NET
ASP.NET BOOKS
C#.NET BOOKS

HOW TO SEARCH AN EXACT MATCH AS ASP.NET THE ONLY ONE ROW

View 3 Replies View Related

Generating Numbers In SQL

Jan 19, 2004

hi,

I am developing a ASP.NET application using SQL Server as my database.
I want to create a number that is unique.

The number will have 8 digits.

first 2 digits correspond to year. ex:04 or 03

the next 6 digits start with 000001 and it should get added for each new entry of data.

i am not able to generate number in the way i said. I am relatively new to SQL. so any suggestions as how to go about solving the problem???. Are there any samples/codes available for this.


Any help would be highly appreciated.

thanks,
-sriram

View 7 Replies View Related

Generating SQL Script

May 31, 2001

Hi all,

I have generated an SQL script such that when it is run, it will automatically create tables if not existing or drop the existing tables. The problem I have is that, is there any way I can also make the script create not only the tables but also transfer the data from the old database to the new database?

I would really appreciate if any of you could point me to any existing programs, scripts etc that can do that. Thanks in advance

Regards,
Celia

View 1 Replies View Related

Generating SQL Scripts

Oct 8, 1999

Is there a way to generate SQL Scripts from a stored procedure?

For disaster recovery and documenation reasons, we'd like to create scripts of our databases periodically. I, being somewhat lazy, would like to automate this so I really don't have to remember to run this every so often.

Any help would be appreciated.

View 1 Replies View Related

Generating SQL Scripts

Jun 7, 1999

Is there a way to generate SQL scripts from other than SQL Enterprise Manager?

View 3 Replies View Related

Generating Nested XML

Oct 29, 2014

I must produce an XML file with this layout:

Code:
<root>
<dataroot>
<Professions>
<Profession>web designer</Profession>
<tags>
<tag>Ruby on Rails</tag>
<tag>Apache</tag>
<tag>HTML/CSS</tag>

[code]...

I can't get my head around it ..I've even tried to solve it by using FOR XML RAW.

View 3 Replies View Related

Generating A Leading Zero

May 13, 2008

Hi

I am unable to see how to generate a leading zero.



Table A

declare @TableA table ( ID numeric ,
Fruits varchar(10)
)
insert @TableA
select 1,'Oranges'
union all select 2,'Mangoes'
union all select 3,'Apricots'


ID Table A
1 Apples
2 Oranges
3 Grapes
4 Apricots


declare @TableB table ( seed numeric ,
)
insert @TableB
select 080513000448
union all select 080513000449
union all select 080513000450

Table B
seed
080513000448
080513000449
080513000450


I wrote the following query but i need generate a leading zero not sure which function can help maybe the right function but i am not sure how to use it in this case


SELECTconvert(varchar(10), getdate(), 12) +
(SELECT
CASE
WHEN SUBSTRING(ISNULL(max(seed),'00000'),1,6) = convert(varchar(10), getdate(), 12)
THEN SUBSTRING(ISNULL(max(seed),'00000'),7,12)
ELSE '000000'
END AS SEED
FROM B)
+ (row_number()
over (order by Id))
as SEED
FROM A



SEED
----
80513000451



The output which i need is

SEED
----
080513000451

rather then

SEED
----
80513000451

regards
Hrishy

View 20 Replies View Related

Generating Numbers

May 12, 2007

A simple question! I would like to create a database that creates say serial numbers and saves them to a table. If poss I would like to create them on demend and not duplicate.....

I have blank page syndrome!!!!

Thanks in advance

View 2 Replies View Related

Generating A Cube ..

Feb 19, 2008

Can anyone suggest a case-study/reference links/video demos for creating a cube using Analysis Services and generation of reports using Reporting Services.

Thank You

View 2 Replies View Related

Generating Sequence

Mar 15, 2008

Guys,

I have to generate sequence for distinct group of values for example

intially seq is set to 1 through out the table

categorydescidseq
__________________________________
AccountingAccounting61
AccountingAccounting72
AccountingFinal81
AccountingFinal92
AddendumAddendum 101

Is there any way to accomplish this?

Any suggestions and inputs would help

Thanks

View 4 Replies View Related

Generating The Csv Files

Mar 31, 2008

hi

how can we generate the data in csv files of database tables by using sql query?


regards

View 3 Replies View Related

Primary Key Generating

Aug 24, 2006

Help again please,I need to insert rows into a table from another table. The tables areidentical column wise except the table im inserting from does not havea primary key value. On insert I need to generate a primary key thatis consecutive based on the table im inserting into. Also the table iminserting into does not have a identity column. Much appreciated.

View 7 Replies View Related

Generating Packages Using C#

May 12, 2006

Hi,

we would like to generate SSIS packages(connections, data flow tasks, etc..) programatically using C#. Is it possible to do so?

At present we are creating packages by dragging and dropping required componets from toolbox and configuring them manually. We have a requirement of creating around 300 packages every week. Manual creation of packages is really a nightmare.

I heard from one of friends that using c# we can create packages. is it true? if so, can we view/edit the packages generated using c# using VS 2005 IDE(if required) ?



Regards,

Gopi



View 4 Replies View Related

Generating Reports On Fly

Mar 29, 2007

Hello,



SRS 2005 provides functionality for loading and rendering reports on fly using LoadReportDefinition and Render methods defined in ReportExecutionService webservice.



I was wondering if the same/similar behaviour can be accomplished in Reporting Services 2000.



Thanks in advance,



Kobi

View 1 Replies View Related

Generating Script

Jul 12, 2007

What does N indicate in the following script

SELECT * FROM dbo.sysobjects WHERE id = OBJECT_ID(N'[dbo].xxxx' )

Plz can anyone explain

EXEC dbo.sp_executesql @statement = N'Create View xxxxx'

View 4 Replies View Related

Generating Sql Logins

Oct 17, 2006

I've been given an excel file that lists:

userID's,
Names
Password
expiary dates.

I need to convert this list into sql server logins. Can this be done via a tsql statement? if so how, and if it cant be done via a statement then what other way can it be done.

Many thanks in advance.

View 2 Replies View Related

Generating A Primary Key

Sep 18, 2007

I'm having problems generating the primary key for a sql server table. I use a slowly changing dimension to discriminate modified and new records. The primary key in the SQL Server table is a combo number/letter incremental (ex. 0000A, 0001A...9999A, 0000B...). I tried creating Instead of insert and For insert trigger for a table but this doesn't seem to do the work.



What are my other options? How can I generate a primary key for every new row?

Any advice is appreciated.
Regards
Sara

View 6 Replies View Related

Generating CREATE Scripts

May 20, 2008

Hello all,
I have a few questions relating to scripts and I'm looking for some help, or at least a point in the right direction.
1) I'm generating CREATE scripts to move a number of tables/procedures/functions from my testing database to my production database.  The issue I have is the script doesn't seem to be generated in a particular order, so I'm getting errors when a table/procedure/function is created that references something that hasn't been created yet.  Is there a setting available to create the script in a specific order to prevent these errors?
2) This is somewhat related to the first question.  I need to drop all the tables/procedures/functions before I re-create them.  Can I set all the DROPs at the beginning of the script, and then run all the CREATEs?
3) Eventually the database will be ready for production and in use.  And eventually I'll be asked to make changes, without erasing existing data.  Can I accomplish this using the generate scripts feature?  What topics should I be investigating when looking into conducting these types of updates?  "Updating database" is too general and I'm not sure the technical term.  I've done very simple DB-related tasks so I'm trying to figure out what I'm looking for so I can educate myself.  Basically, I don't know what I don't know.
Any help is appreciated.  Thanks.

View 1 Replies View Related

Generating Tables Programatically

Jun 7, 2008

hi i am trying to gernerate some tables ( first with a script and then with a stored procedure),, in ms server management studio exrress 2005 using the followingcreate table ip(    id int IDENTITY NOT NULL,    ip varchar(15) NOT NULL,    hostname varchar(128) NOT NULL,    primary key(id)) ; i store this in a new query (assume :right click associates the query to the current database ?) and run it and nothing happens  its been a while since i did sql but i think the sql is ok....how or more specifically where is the appropriate place to run this code  thankssimo  stored as a new query     

View 1 Replies View Related

Generating Text File

Dec 4, 2003

I have a table(say tblUserInfo) on SQL Server. What I like to do is a text file will be generated on the hard drive which SQL Server sits on when a new record is inserted into tblUserInfo. The content of the text file comes from the table. Is there any way we can go for doing that?

View 2 Replies View Related







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