Counting Posts Of Individual Months

Apr 17, 2008

Hi !
i am developing feature like blogs where a user posts but what i am looking for a stored procedure which could count that how many post were made in a particular month like

jan2008 (3)
feb2008 (8)

so any one could provide me helping link....

View 9 Replies


ADVERTISEMENT

The Posts Should Not Be Older Then 2 Months In Database

Jan 28, 2008

Is it possible to send a email after a certain date has pass by. And 2 days after the email has been sent the post should be removed if the member doesn't answer the message.
example: The posts should not be older then 2 months. When they get older than 2 months the SQL-Server detects this post and sends a messegae to the member if he wants to renew it. If he ignors it for 2 days after the email the post will be removed from the database. (Some posts have images also, They should also be removed from the harddrive)
Is this possible in MSSQL-Server to send email?
If someone could tell me how to create this.

View 6 Replies View Related

Counting Daily Events For All Months

Jul 24, 2007

Hi Again,

I have now had the request to pull out more information but now lits all the days and the call that were logged.

I have tried to adjust the script I was given in this forum but I do not know enough to get it working.

It ultimatly does what I require but nw listing all the days in a month with a count of records.

This is the script I was given.

select month(DateRaised) as mth
, count(*) as mth_count "
from HD_Call
where [DateRaised] >= '2007-01-01'
AND [DateRaised] < '2008-01-01'
AND [Completed] IN(1, 0)
GROUP by month(DateRaised)

Is it possible to get

Day day_count
1 32
2 21
3 12
4 1
5 0
6 12
...
31 25

View 8 Replies View Related

Selecting Data Within 1 Month, 6 Months, 12 Months

Mar 27, 2008



I have the following table



FeedBack Type Date

test2 positive 03/15/08

tes3 negative 03/01/08

.. ....



in my page i need to select the number of negative/positive comments within the last



1 month, 6 months, 12 months



How can I accomplish that?
thanks

View 5 Replies View Related

Swallowed Posts

Feb 17, 2007

is something wrong with this webite or is it moderated?

i have tried 5 times to post and it never appears. i just get a brief message flash after posting that says 'if xxxx has chosen to moderate.... you will be taken to that thread' then i go to that thread. no post.

if i resubmit, i get '...duplicate post in last 5 minutes' - if it's duplicate, where is the post? this forum is becoming too frustrating for me to use.

View 5 Replies View Related

Query For No Of Topics & Posts

Jun 12, 2008

I need query to fetch values of postedname,repliername,categoryname,no of topics,no of posts from the 4 tables mentioned below.

tablename----categorymgmt
fields----categoryid,categoryname,categorydesc

tablename----forum_topics
fields----topicid,categoryid,topic,userid,description

tablename----from forum_reply
fileds----replyid,topicid,userid

tablename----usermgmt
fileds----userid,username

View 16 Replies View Related

Katmai Questions / Posts?

Jun 6, 2007

Where are we suppossed to ask questions about Sql Server 2008 (Katmai)? The connect site points people to the Sql Server forum here.



Wally



View 1 Replies View Related

Get Last Posts Of A Group Users

Sep 11, 2007



Hello dear coders

I have two tables (Members and Blogs)

I want to get the last posts of my user group 2 for each user i want to see this sentences

i-developer : last post on 5 May 2007 at 3.55 am
kingalone: last post 0n 6 June 2007 at 400 am

so i tried a lot of sql queries but none of them succed

my codes are;




SELECT Members.Username, Blogs.IsPublished, Blogs.PublishedDate

FROM Members INNER JOIN

Blogs ON Members.MemberID = Blogs.MemberID

WHERE (Members.RoleID = 2)

ORDER BY Blogs.EntryID

group by Username

select Max(EntryID),MemberID from Blogs where RoleID = 2

with FilteredLastPost ( MemberID,EntryID,PublishedDate)

as

(

select MemberID,EntryID,PublishedDate from Blogs where IsPublished = 1 and MemberID in( (select MemberID from Members where RoleID = 2)) order by EntryID desc, MemberID asc

)

select MemberID from FilteredLastPost

select distinct Blogs.MemberID,EntryID,PublishedDate from Blogs

right join Members on Members.MemberID = Blogs.MemberID

where not PublishedDate ='' and IsPublished = 1 and Members.RoleID = 2

order by EntryID desc, PublishedDate desc









select DISTINCT MemberID, EntryID, PublishedDate DISTINCT IsPulished from Blogs where IsPublished = 1 and not PublishedDate ='' and MemberID in ( select MemberID from Members where RoleID = 2 )

View 3 Replies View Related

Need Help For Selecting Posts In SELECT Statment

Dec 4, 2007

I'll try to explane what I am looking for.

I'd like to select from a table, let say with 2 variables. One with a currency and one with integer. The integer value is a number between 0 and 255. The integer value represents a value of what kind of BIT is turned on in one BYTE.

Down to business.

I am looking for all BYTES with the fifth BIT = 1 as in example 00001000.This represents the value of 16. This value is an integer in my table. But as you see, the BYTE has a number of different values with the fifth=1 as the rest of the BITS can be 1 as in example 01011000 = 26.

Down to code.
Tablename = myMoney
Column Name = mCurrency; Data Type = decimal(18,2)
Column Name = bit5; Data Type = int





Code Block

SELECT sum(mCurrency)
FROM myMoney
WHERE somefunction(bit5) = 1





I have made the code in VB some time ago but this time I need to do the aclculation in the SQL server.

Hopefully Robin M

View 1 Replies View Related

Own Forum - Number Of Posts And Stars/ranges - How To Make It ???

Oct 27, 2006

So I have simple forum. At main page I have gridView which display topics. When I go to topic #5 (for example) I use repeater to display posts and authors. Here is a code: SELECT aspnet_Users.UserName, forum_posts.post_id,forum_posts.post_content, forum_posts.topic_id, forum_posts.post_date FROM aspnet_Users INNER JOIN forum_posts ON aspnet_Users.uID = forum_posts.user_id WHERE (forum_posts.topic_id = @topic_id) Now I have a problem - how can I display with each user his number of posts - eventually how can I display for example if he has 25 posts - one star, 50 posts - two stars, or maybe display "Starter" range, etc. How to make this, cause I don't have any idea. 

View 9 Replies View Related

What MS SQL Data Type Should Be Used For Storing Things Like Forum Posts ?

Mar 31, 2008

Let's say a user profile page on a website contains a description about a car that the user wants to sell.  The user could try to be wise and write something very short like "buy my car" or the user could write a very lengthy description of his car to convince the buyer to make the purchase.
Or somebody creates a thread in a forum or replies to a topic (much like what we do here).
In these instances, what is the most efficient manner of storing the high-character content in these examples with SQL Server 2005?  Keep in mind that a user could make a 2-character post like "OK" or could write a long reply or create a huge profile.  So the data type has to be efficient and flexible.  Judging from the list of available types in my Express 2005, I would guess the varchar(MAX) or the text data types could be used.  Or would I use some other data type?
TIA.

View 4 Replies View Related

Keep Failing On Trying To Install SQL 2005 Express (I've Read Many Posts But Still No Solution)

Jan 2, 2008

I use Widows Vista Business, have uninstalled all previous versions of SQL before installing SQL 2005 Express.

At first, I faced "Receiving WMI configuration error. SQL Server System Configuration cannot be executed due to to WMI configuration on this computer Error:2147749896 (0x80041008)."

Then, I tried this cmd someone posted as:





FIXWMI.CMD
------------------------

@echo on
cd /d c: emp
if not exist %windir%system32wbem goto TryInstall
cd /d %windir%system32wbem
net stop winmgmt
winmgmt /kill
if exist Rep_bak rd Rep_bak /s /q
rename Repository Rep_bak
for %%i in (*.dll) do RegSvr32 -s %%i
for %%i in (*.exe) do call :FixSrv %%i
for %%i in (*.mof,*.mfl) do Mofcomp %%i
net start winmgmt
goto End

:FixSrv
if /I (%1) == (wbemcntl.exe) goto SkipSrv
if /I (%1) == (wbemtest.exe) goto SkipSrv
if /I (%1) == (mofcomp.exe) goto SkipSrv
%1 /RegServer

kipSrv
goto End

:TryInstall
if not exist wmicore.exe goto End
wmicore /s
net start winmgmt
:End

I tried to install SQL2005 Express again, but then it gives:

Error 1603 installing Microsoft SQL Native Client.

View 1 Replies View Related

Help - Security Event Log Posts Error Event ID 560 Every Few Seconds

May 31, 2007

Server 2003 SE SP1 5.2.3790 Sql Server 2000, SP 4, 8.00.2187 (latest hotfix rollup)
We fixed one issue, but it brought up another. the fix we applied stopped the ServicesActive access failure, but now we have a failure on MSSEARCH. The users this is affecting do NOT have admin rights on the machine, they are SQL developers.
We were having

Event Type: Failure Audit
Event Source: Security
Event Category: Object AccessEvent ID: 560
Date: 5/23/2007
Time: 6:27:15 AM
User: domainuser
Computer: MACHINENAME
Description:
Object Open:
Object Server: SC Manager
Object Type: SC_MANAGER OBJECT
Object Name: ServicesActive
Handle ID: -
Operation ID: {0,1623975729}
Process ID: 840
Image File Name: C:WINDOWSsystem32services.exe
Primary User Name: MACHINE$
Primary Domain: Domain
Primary Logon ID: (0x0,0x3E7)
Client User Name: User
Client Domain: Domain
Client Logon ID: (0x0,0x6097C608)
Accesses: READ_CONTROL
Connect to service controller
Enumerate services
Query service database lock state

Privileges: -
Restricted Sid Count: 0
Access Mask: 0x20015



Applied the following fix

http://support.microsoft.com/kb/907460/


Now we are getting



Event Type: Failure Audit
Event Source: Security
Event Category: Object Access
Event ID: 560
Date: 5/23/2007
Time: 10:51:23 AM
User: domainuser
Computer: MACHINE
Description:
Object Open:
Object Server: SC Manager
Object Type: SERVICE OBJECT
Object Name: MSSEARCH
Handle ID: -
Operation ID: {0,1627659603}
Process ID: 840
Image File Name: C:WINDOWSsystem32services.exe
Primary User Name: MACHINE$
Primary Domain: domain
Primary Logon ID: (0x0,0x3E7)
Client User Name: user
Client Domain: domain
Client Logon ID: (0x0,0x60D37C1A)
Accesses: READ_CONTROL
Query service configuration information
Query status of service
Enumerate dependencies of service
Query information from service
Privileges: - Restricted Sid Count: 0 Access Mask: 0x2008D

View 4 Replies View Related

Getting Individual Count In Table

Mar 28, 2008

I have a link that inserts postid, catid, and postdate.  I am trying to get count of catid(how many times its in the table) then display the number on a page.  i have never tried this before.  one more thing.  Can you put a datalist inside a formview when the formview is databound already? Can someone help?  Thank you.
 

View 7 Replies View Related

Restore Individual Filegroups

Aug 25, 2000

I am trying to restore from a backup of an individual filegroup in SQL Server 7.0. I have backed up the individual filegroups, and I want to restore one of them (not the whole database). The process in EM is almost the same as restoring the entire database, only you choose the radio button 'Filegroups' and the files/filegroups you want to restore.

The restoration appears to complete sucessfully, but afterward, my database seems to be permanently loading. In other words, in EM the database is greyed out and you cannot use it anymore. It stays like this until you drop the database altogether. Is this a bug? Has anyone else had this problem or does anyone have experience restoring from filegroups sucessfully???

View 1 Replies View Related

Backing Up Individual Tables In A Db

Feb 8, 2001

What is the best strategy for backing up individual tables in a database, not the whole database? Thank you for your help.

Best Regards,
Mark

View 4 Replies View Related

How To Break In Individual Columns

Jan 2, 2015

I am recieving complete row in one single column and I have pipe delimeter in this row . I want to retrieve the data in individual columns...Currently row is in one column

Data
02|vinod sahu

Expected output

Col1 col2
02 VInod Sahu

View 4 Replies View Related

Retrieving Individual Characters

Mar 6, 2008

Here's my two tables:

tblClients
--------------------------------------------------
ClientID (varchar(3)) | ClientName (varchar(100))
--------------------------------------------------
001 | First
002 | Second


tblProjects
---------------------------------------------------
ProjectID (varchar(6)) | ProjectName (varchar(100))
---------------------------------------------------
001001 | First Project1
001002 | First Project2
002001 | Second Project1
002002 | Second Project2




As you can see, the ClientID is the first 3 digits of the ProjectID, signifying that a certain project belongs to that client. I know it's a bad design, but I can't change the DB, I have to use it.

The problem is that I need to join the two tables based on the ClientID, but I don't know how to just retrieve the first 3 numbers in the ProjectID.

I need something like:
tblClients INNER JOIN tblProjects ON
tblClients.ClientID = tblProjects.First3DigitsOfTheProjectID

View 2 Replies View Related

Running Individual Tasks In ISS

Feb 14, 2006

Hi,

In previous versions of SQL Server you were able to execute single steps within a DTS package. It doesn't seemt to be possible in visual studio. Does anybody know otherwise?



Thanks

View 1 Replies View Related

Union V Individual Calls

Aug 18, 2007

Suppose my database has 3 table A though C and I need to get the number of records in each. I could do it as individual selects like
SELECT 'A' AS 'Table', COUNT(*) AS 'Count' FROM A
SELECT 'B' AS 'Table', COUNT(*) AS 'Count' FROM B
SELECT 'C' AS 'Table', COUNT(*) AS 'Count' FROM C

or
SELECT 'A' AS 'Table', COUNT(*) AS 'Count' FROM A
UNION
SELECT 'B' AS 'Table', COUNT(*) AS 'Count' FROM B
UNION
SELECT 'C' AS 'Table', COUNT(*) AS 'Count' FROM C

Is there any problem in unioning statements like these? In reality there were over a hundred tables and the TSQL was generated by looping through SYSOBJECTS. I eventually used the first construct as the XML was simpler to generate.

View 6 Replies View Related

UpdateBatchSize Fires Individual Statements

Jun 30, 2006

In Pablo Castro webcast, First Look at ADO.NET 2.0, he mentions the use of UpdateBatchSize which I think would be handy.However, I was not able to get it to work.


Dim t As New Global.System.Data.SqlClient.SqlDataAdapter("Select * from Table_1", Global.System.Configuration.ConfigurationManager.ConnectionStrings("ConnectionString1").ConnectionString)Dim d As New Global.System.Data.DataTablet.FillSchema(d, SchemaType.Source)Dim cb As New Global.System.Data.SqlClient.SqlCommandBuilder(t)For c As Int32 = 1 To 10000Dim r As Global.System.Data.DataRow = d.NewRowr("id") = Global.System.Guid.NewGuidr("val") = CType(Rnd(), Int32)d.Rows.Add(r)Nextt.UpdateBatchSize = 100t.Update(d)d.Dispose()t.Dispose()


What ends up showing in Sql Server Profiler (Sql Server 2005) is each Insert being executed in it's own statement:exec sp_executesql N'INSERT INTO [Table_1] ([id], [val]) VALUES (@p1, @p2)',N'@p1 uniqueidentifier,@p2 int',@p1='3793CB5E-3B7A-45E7-9A53-0BD528BB6B07',@p2=1
I think I made this example very simple and yet can't fathom why it won't batch the statements.
I'm somewhat aware of SqlBulkCopy and was very pleased with that speed, but don't think it would handle the Update,Delete,Insert that the SqlDataAdapter.Update would.
Originally started using xsd DataSets until I saw the data tutorials in the Learning section here in which case I copied out the autogenerated TableAdapter classes and fuddling with them to do what I want since batching was not something I saw in TableAdapters.
Does anyone see what I'm missing here?Nathan

View 2 Replies View Related

Query Individual Records Within A Table

May 21, 2002

Please can someone advise me on how I can create a statement that will query each individual row within a table.

As the data will vary month by month I'm unable to state the amount of rows that will need to be queried.

An Overview:
We have web-based application with a SQL back-end. When changes are made to a record a copy of that info is sent to another table (a quick snapshot, name, date, number, department etc.). At the end of the month I need to apply this data to an imported itemised phone bill so that I can make sure that if the mobile phone had been reallocated to another person I can change the cost accordingly.
As it stands the operator has to print a copy of the phone details before reallocating to another person. Then at the end of the month manually changes the data within the itemised bill by referring to the printouts. Ideally I would prefer to automate the whole process.

Please find below the script - its very much in its infancy!!

CREATE PROCEDURE sp_reallocate AS
select * from tbl_mobile_reallocate
order by allocation_change_date

update tbl_mobile_import
set empno = tbl_mobile_reallocate.empno from tbl_mobile_reallocate
where tbl_mobile_import.mobno = tbl_mobile_reallocate.mobno
and tbl_mobile_import.invoice_date <= tbl_mobile_reallocate.change_date

update tbl_mobile_reallocate
set status = 'Closed'
GO

View 3 Replies View Related

Restore Individual Filegroups (reply)HELP!!!!!!

Aug 28, 2000

I think jthis is a bug. I have a table created and populated on its own filegroup. I backup the db(all filegroups) and the trans log then I drop the one table. When I try to restore from my backups, it insists that I back up the trans log again. I do, then do the restore of both the filegroup and the trans log. The restore finishes, but my table is still not there and I can never get it back.

Any one with comments please help
Brad kreuzburg

View 1 Replies View Related

Passing Parameters For Individual Rows

Aug 4, 1998

First of all, I`m a very new entrant to the world of SQL Server. So I`ll make some mistakes.

I need to know how to write a stored procedure that will insert or update INDIVIDUAL rows. All the documentation I`ve seen is pretty coy on how to actually do this.

Any actual examples, or any tips at all would be greatly appreciated.

Thank you very much.

View 1 Replies View Related

Renaming Individual Items In A DTS Package

Feb 5, 2002

I am writing a utility that browses all steps, connections, and tasks in a given DTS package. One of the functions is to rename each item using its description, ie, removing spaces, formatting it, and then appending it to the standard DTSTask_ActiveScriptTask_MyCustomNameDerivedFromTh eDescription. I am being sure to change everything to match this in both the Step and task for a given set. The behaviour that is occuring is this. The package appears to be named correctly, and even seems to run correctly, but none of the precedence constraints, it, OnFail, OnSuccess, OnCOmpletion seem to show up in the DTS Designer Environment. The package does seem to be running correctly, any idea what would cause this behaviour?

View 1 Replies View Related

Restoring Individual Objects From Backups

Sep 6, 2001

SQL Server's Books On-line seems to hint that this can be done. Does anyone have any info or practical application of this? Can someone confirm that this is possible please.

Aquafortis

View 1 Replies View Related

Manipulating Individual Fields Of A View

Nov 13, 2007

In my database I have a table for Users, with an int primary key, and a table for Connections, with a combined primary key consisting of two UserID foreign keys. (the smallest first)

At the point I am stuck I have one UserID, lets call it current_user, and a column returned by a select statement consisting of UserIDs. Some of these IDs will likely be smaller than current_user, and some will likely be larger.

What i need to do is construct a view of two columns, combining each of the UserIDs in the column I have with current_user, with the smallest UserID of each pair residing in the first column, and the largest in the second column.

The point of this is to then SELECT the connections identified by the UserID pairs.

I suspect I could accomplish this if I could set individual fields in the a view, but I seem to have missed (or forgotten) that lecture. Anybody want to clue me in?

View 6 Replies View Related

Remote Access To Individual Databases

Jan 17, 2008

I have SQL Server running on our web server located at a managed hosting site at Rackspace. I've got some developers who are going to be editing various sites and will need access to specific databases. Is there something built in to MSSQL, or a third party app, which will allow for this kind of remote access? They will be doing everything from restructuring these DB's to just inputting data.

Thanks!

Chris Sanders

View 8 Replies View Related

Creating Table From 3 Different Individual Tables

Jan 28, 2013

In SQL Server, I need to create a table from 3 different individual tables. I am new to the SQL Scene, so i want to know the best way to go about this. Each table has different fields, so that is making it difficult (at least for me). How about creating 1 table, that is composed of 3 other tables?

I know this is bad practice, but our District Manager wants to see production for his 'team' and whoever set this up back in the beginning gave each individual employee a different table, with custom fields (Why?!?!?!?!) so now I am trying to merge those 3 into 1, but want to get some insight on the best way to do this since there are different fields in each table and the merged (or master) table needs to have all of those fields.

View 11 Replies View Related

Failure Notifications For Individual Steps?

Apr 18, 2008

Good day,

I have a Job that runs every half an hour, and has about 30 steps. If a step fails it moves on to the next step (the steps are not dependant on one another)... However I would like to receive notification if that occurs. I have SQL 2005, with database mail enabled and set up (works fine for other jobs)... The question is how do I get it to send me an email if a single step fails, however the job on a whole succeeds?

Do I need to set up a step between each job?

Step 1 An actual step, on failure: step 2 On success Step3
Step 2 A step that emails the failure of step 1, then goes to step 3
Step 3 An actual step

etc etc... Or is there a better way?

View 1 Replies View Related

How To Find Out The Count Of Individual Chars

May 14, 2008

Hi,
Can any one tell me
how to find out the count of individual chars in a String

ie., my string is s='ganesh kumar'
my output must be as below

Character Occurance
--------------------
g 1
a 2
n 1
e 1
s 1
h 1
k 1
u 1
m 1
r 1
----------------------

Can any one do it,
This is interview question..

Ganesh


Solutions are easy. Understanding the problem, now, that's the hard part

View 7 Replies View Related

Backup Individual Files Vs Whole Database

May 10, 2007

We have a pretty large SQL Server database, just shy of 400 GB. It is divided up into 24 different data files. The previous DBA here said it is faster to backup the backup individual data files to seperate files. So what he did was issue 6 backup statements like the one below as a step in an agent job.

BACKUP DATABASE MYDATABASE
FILE = 'Data',
FILE = 'data2',
FILE = 'data3',
FILE = 'data4'
TO Data1_4
WITH FORMAT

Next step:

BACKUP DATABASE MYDATABASE
FILE = 'data5',
FILE = 'data6',
FILE = 'data7',
FILE = 'data8'
TO Data5_8
WITH FORMAT

etc.. in sequence.

What I question is how this is faster than just issuing a backup for the whole database? Has anyone ever ran into this before?

- Eric

View 9 Replies View Related

Assign Permissions For Individual Table.

Jan 15, 2008

A login named UserLogin1 has db_dataReader and db_dataWriter roles, and three schemas which are db_owner, dbUser1, and dbUser2 in a database named Database1. I wanted to have some tables for read-only, so I right clicked on the table and select properties. In the Permissions tab, I added UserLogin1 and checked Alter, Delete, Insert, Take Ownership, and Update under Deny. It worked for schema dbo only. I did the same steps for the tables that have schema dbUser1 or dbUser2, but UserLogin1 I added didn't stay. Why? How can I make those tables read-only?

Thanks.
DanYeung

View 3 Replies View Related







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