Count All Things Happened Today
Nov 11, 2007
Ive got a table of notes people have created, with a field called "timecreated" which has a default value of "GETDATE()" Im trying to write an SQL statement that will count up all of the notes that people have created today/ yesturday etc. i could do it if the timecreated value was a "short date string" styled date, but its set up like : 11/11/2007 18:51:46 is there way of converting it before counting? if theres a simple way of doing this i would appricate any help thanks John
View 7 Replies
ADVERTISEMENT
Jan 24, 2007
You can use a Select top @variable in sql server 2005:Thus:--'Throttle' the result set:Select Top (@MaxBatchSize)KeyID, LId, ArrivalDt, CaptureDt, Lat, LongFrom GPSDataOrder By CaptureDt DescMakes messing with Set Rowcount *so* redundant :-)
View 1 Replies
View Related
Mar 20, 2004
I would like to AUTOMATICALLY count the event for the month BEFORE today
and
count the events remaining in the month (including those for today).
I can count the events remaining in the month manually with this query (today being March 20):
SELECT Count(EventID) AS [Left for Month],
FROM RECalendar
WHERE
(EventTimeBegin >= DATEADD(DAY, 1, (CONVERT(char(10), GETDATE(), 101)))
AND EventTimeBegin < DATEADD(DAY, 12, (CONVERT(char(10), GETDATE(), 101))))
Could anyone provide me with the correct syntax to count the events for the current month before today
and
to count the events remaining in the month, including today.
Thank you for your assistance in advance.
Joel
View 1 Replies
View Related
Oct 28, 2005
SQL 2000I have inherited an application where many of the automated processescall a proc that simply returns the number of records with a NEWstatus.In watching the process in SQL, I see this ends up blocking a lot ofprocesses - many like this are called every 5-30 seconds ...I wish to replace COUNT(*) with EXISTS if that will make things operatefaster with no locks ...Thoughts ...Thanks everyone !!Craig
View 1 Replies
View Related
Jan 7, 2004
Hi everybody!
Something strange happened to one of my SQL Databases.
One of my User Defined Funcitions has lost ALL its roles permissions!
I created this UDF a long time ago and I assigned permissions to some specific Roles to run the UDF. It worked fine until today. All of a sudden there were no permissions for any role for that UDF. I am the only Admin for the DB.
I reassigned the roles permissions and it seems to be working fine now.
How could this happen ? has anyone here experienced something like this before ?
Thanks!
View 14 Replies
View Related
Mar 5, 2004
http://www.dbforums.com/showthread.php?postid=3636029#post3636029
View 2 Replies
View Related
Mar 18, 2004
Rules...
"Clean up your room, stand up straight, pick up your feet, take it like a man, be nice to your sister, don't mix wine and beer, Oh, and don't drive on the railroad tracks..."
http://www.dbforums.com/t989246.html
View 2 Replies
View Related
Jun 8, 2007
Hi!Weird thing today!I opened Visual Studio 2005 and I can only see themastermodelmsdbtempdbSystem DatabasesWith the SQL Server management studio I can still see all mydevelopment DB, but NOT fron Visual Studio.There has been some maintenance on the machine done by tha servicedepartment, but they don't know what to say.Anyone has an Idea of what happened?Thank you!Piero
View 2 Replies
View Related
Sep 16, 1998
I have obtained control of yet another server. When I open Enterprise Manager, I don`t get the traffic lights on the new server to light up. Also the sqlexec (wheels) do not even appear. The server and I are on different workgroups, but another user, who is also in a different workgroup from the server gets everything to show fine. What happened? My other 3 servers appear just fine. What is my lack of connectivity?
View 1 Replies
View Related
Oct 11, 2005
Hey, who took the sticky down?
View 2 Replies
View Related
Nov 20, 1998
In the SQL Object manager tools for sql server 4.21 there was a gui interface for running BCP where you could select tables and fields etc.
I haven't beem able to find abnything equivalent in sql 6.5 enterprise manager. Am I missing someting, or was this dropped?
Thanks.
Jerry Dunn
ViaHealth
jerry.dunn@viahealth.org
View 1 Replies
View Related
Jul 30, 2013
How i can find out the changes happened in database like modifying functions,table indexes,procedures and adding or removing columns..here in this query
select * from sys.objects
where type IS NOT NULL
and modify_date between '2013-07-21' and '2013-07-29'
but here i am getting created objects list and modifying list.but if i deleted any object it is not showing anything..how can i get the all the changes happened in database between specific dates.
View 3 Replies
View Related
Sep 13, 2007
In SQL Server 2000 you can monitor active processes by looking at the sql_handle column in sysprocesses. In SQL Server 2005 BOL says sql_handle ...
Represents the currently executing batch or object.
In SQL 2000 a non-zero value in sql_handle indicated an active process. You could not simply rely on the status column to check for an actively running process. This is not the case in 2005. I ran a profiler trace to confirm that just because sql_handle reports a non-zero value does not mean the corresponding process is active. Does anyone know why this has changed and how we are now to interpret sql_handle in 2005? Why are non-zero entries reported for processes that are not currently running?
Thanks, Dave
View 1 Replies
View Related
Nov 1, 2000
I have W2K Adv, SQL 7 Enterprise in a workgroup with mixed security. The SQL installation is an almost entirely default install.
At the console, in SQL Enterprise Manager, when I select open a database, open tables, select a table, open table, and select all rows the system displays "an unexpected error happened during this operation". As far as I know this has never worked on this installation.
The error occurs with every logon account (including sa and local administrator accounts), both the "all rows or top row" options, every table, every database (including the customers database and the Northwind database).
I have tried adding administrators and accounts as users of the databases etc. and given the accounts all the permissions I can dream up.
There are no interesting messages in the event viewer. The SQL agent is running.
Technet found two documents but not related to the problem.
I can run SQL Analyzer and run "select * from table_name". That works on the Northwind and customer database tables - every time.
Colleagues with other installations do not get the error, and their systems return the rows correctly.
If any of you can help, I'd really appreciate it.
View 3 Replies
View Related
Jan 29, 2008
I just go a new job where I work with Point of Sale machines and I'm having a hard time figuring SQL 2005 out. When I was in school we were taught using SQL 2000. Some of our POS (Point of Sale) machines are moving over to using SQL 2005 Express and I am having the hardest time figuring all this out. All be it I haven't use SQL in a good while but I still remember how to administer SQL 2000 with Enterprise manager. Am I missing something or what's the deal hear.
Any help would be much appreciated!
Best regards,
--Bob
Bob McQuay
ADI Business Solutions
bobm@adionline.com
Network Technician
View 2 Replies
View Related
Feb 21, 2006
Hi
I had DTS the Northwind sample database from SqlServer 2000 to 2005. It's went ok and no errors. Then, I created a SP named upGetCustomer, bascially it queries the Customers table and list some of it's fields and order by CustomerId,CustomerName, Country decrementally. SP is so simple and has no errors.
Then, I created a SqlServer project in VS2005 using C#. Add store procedure class as below,
using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
public partial class StoredProcedures
{
[Microsoft.SqlServer.Server.SqlProcedure]
public static void Customers(string customerid)
{
using (SqlConnection sqlConn =
new SqlConnection("context connection=true"))
{
sqlConn.Open();
SqlPipe sqlPipe = SqlContext.Pipe;
SqlParameter param = new SqlParameter("@custId", SqlDbType.VarChar, 5);
param.Value = customerid;
SqlCommand sqlCmd = new SqlCommand();
sqlCmd.CommandType = CommandType.StoredProcedure;
sqlCmd.CommandText = "upGetCustomer";
sqlCmd.Parameters.Add(param);
SqlDataReader rdr = sqlCmd.ExecuteReader();
SqlContext.Pipe.Send(rdr);
}
}
I had taken method of created SQLCLR from source in Microsoft website, but coding is mine, and hopes it is correct. I used SqlConnection string as 'context connection=true' which I still not quite sure what does it means, hopes it mean current connection I am using on my Windows authentication.
The project did compiled & deployed OK on the VS2005 side.
The problem is that when I tried to locate the assembly on the Sql Server 2005, but can't find it anywhere on Sql Server.
I did try complied and deloyed again, it keeps saying there is an error in deployment as customers assembly is already exist on the database. I then, tried to remove this assembly on the database using SQL script, drop assembly customers in the Northwind database but got error saying it does not exist. So where is it???
Please help...
Thank you
View 1 Replies
View Related
Mar 16, 2007
I guess I just don't get the reasoning behind the new SqlDataSource control. Haven't we just spent the last decade or so evangelizing and learning how and why to separate business logic from the display in VB 6 and VS.NET? In this age of programming for disparate devices (desktop, mobile, PocketPC, etc.) when this separation makes more sense than ever, why is MS pushing us to go back to putting our logic and data access rules and objects back in the display? It doesn't make sense. Why would anyone do this? And why would all the experts and MVPs at ASP.NET, DevX, 4GuysFromRolla, etc., go along with this?
View 4 Replies
View Related
Dec 26, 2005
What happened to nice SqlDataAdapter.Fill method in ASP.net 2.0 + How can i now access and traverse trhough table.
ex : sqlDataAdapter.Fill(dataSetname.tblsname);
dataSet11.rows[][]
View 5 Replies
View Related
Nov 7, 2006
Anyone know what happened to the release of Donald Farmer's book "The Rational Guide to Extending SSIS 2005 with Script"? I ordered it back in June and it still says "Item is not released - expected to ship July 3"
Looks like the latest update has it coming out in December... every 3 months or so the release date gets pushed back.
LOL with my luck by the time it gets released I will be finished with the giant data warehouse ETL project I've been working on since July and I will read the book and swear a lot becuase I'll find there was much easier ways to do things via script than the way I did them. :)
View 3 Replies
View Related
Jun 11, 2015
I have a transaction table to store all the transaction happened on a single day. as per my requirement I wrote the query like this select Currency Code,TransactionCode,TransactionAmount,COUNT(TransactionCode) as [No. Of Trans] from TransactionDetails where TransactionCode in ('BNT' ,'BCN','BTC','STC','SCN','SNT') group by TransactionCode,CurrencyCode,TransactionAmount order by CurrencyCode..I got the result like this
My I want to show this result like this
ARS
BNT 0 0
BCN 0 0
SCN 1 12
BTC 0 0
STC 0 0
SNT 0 0
[code]...
and so on for all the the currency lists.how can I achieve like this .
View 6 Replies
View Related
Apr 19, 2002
I am writting a T-SQL script to install my database. I have figured out all the sets except 2 areas.
1. Give login db_datareader / db_datawriter permissions to a DB
2. Add a DTS Package, it uses a script, and schedule it.
Here's how I do them in EM....
Issue 1: Security - Logins,
Right click on login, select properties
In database access tab, check Permit for DB
In database role, check public, db_datareader, db_datawriter.
Issue 2: DTS - Local Packages
Right click on local package, new package.
Create SQL connection & exe SQL task (attach seperate SQL script)
Save
Right click on newly created package and schedule
View 2 Replies
View Related
Dec 6, 2007
Hello everybody ,
I want you to explain me something that i find a little strange.
Yesterday i had a problem with a huge log file and a friend in here helped me fix this by making a log back up and then shrinking it to 200 MB.Everything went fine.When i returned home i tried something else in a test environment..Here what happened:
I Got a full database back up.
I dropped the database.
I created a new one with 1GB mdf and 250MB ldf.
I vanished the log back -up
I restored the mdf file on the new database
The log file again had the same huge size after the restore.
How did this happen?
I sell my mother in law.Is anybody interested?
View 6 Replies
View Related
Feb 12, 2008
Hi all,
a question that has been in my mind for a while:
A HEAP is a table that has no clustered index.
Now consider a table that has a unique clustered index (primary key) on an identity column ?
For example:
create table Test
(
TestId int identity(1,1) not null,
...,
constraint PK_Test primary key clustered (TestId)
)
Is there a recognised term for such a table ?
Thanks
Graham
View 4 Replies
View Related
Dec 5, 2005
One interviewer has asked me the following question:
What are the things that you consider while designing database?
I have told about integrity constraints, and normal forms.
but he has added 15 more concepts like
1. indexers
2. Table columns
3. Table rows
4. search facilities
6.......
Can any one give full Idea on this question?
Thanking you Ashok kumar.
View 1 Replies
View Related
Aug 23, 2005
A book is like a garden carried in the pocket.
<edit> links removed </edit>
View 1 Replies
View Related
May 11, 2007
I have made a report in SRS and am not sure of how to do some of the functions I need.
In SQL I can use UPPER to convert to upper case, SRS doesn't seem to like this. The report runs but the line that is to be upper case is missing. If I remove the UPPER word from my query it works fine just displaying in lower case. Am I doing something wrong?
In Excel 2007 (I am converting my report from Excel to SRS) there is a function called NETWORKDAYS (Returns the number of whole working days between start_date and end_date. Working days exclude weekends and any dates identified in holidays. Use NETWORKDAYS to calculate employee benefits that accrue based on the number of days worked during a specific term.) Is there something similar I can use in SRS?
Thanks.
View 3 Replies
View Related
Jul 24, 2007
Okay,
I'm creating a small application for my local school district that will allow them to do a small management of inventory.
Is there a way to create an executable script that will create the default databases the first time? If so, what all do I need to do for the script and to make it execute?
I want to make a section in my OPTIONS area where users can put the path to their db (will not be hosted on the same PC as the software) along with the username and password for the db. I know I can store this information in a predetermined variable in the program so that it can reference it off and on.
Could someone please help me with this..... If it's in the wrong forum please let me know.
Thanks,
QWERTYtech
View 5 Replies
View Related
Jun 16, 2007
Hello.
I am a newbe in this and I tried to find the information on the msdn but could not find a god answer.
I am using VisualStudio Express 2005 and a SQL Server Express version.
In a Visual Basic application I use "radio buttons", "tick boxes", "Combo Boxes" and "Numeric Up Down".
But I cant figure out what data type to use to save the data in a SQL server.
It would be nice to have a document that maps the different data types to use in SQL Server according to what object you are using in the Visual Studio.
Thanks in advance.
/Martin
View 1 Replies
View Related
Jan 14, 2008
Good afternoon,
I've here a shell plugin and it's compiling fine and can be viewed in BI Dev Studio when choosing the DM technique using the proper wizard.
I also have here a K-Means implementation that estimates the number of clusters using a statistical semi-empiric index (the PBM index).
This implementation is done in C# and works fine. But it has to receive all the data of the database (all variables for each row) in order to do the proper vectorial calculations in a CSR (Compact Sparse Rows) way.
Besides, as you know, K-Means needs all the data at once because of the clusters mean (centroid) calculation.
So, I have some questions:
1) Where to place the call to the K-Means implementation in the shell passing as argument an object holding all the data ?
2) After this call, with the data clustered, what other objects must be modified in order to use Microsoft Cluster Viewer ?
3) I will need to create a new column or a new table on the database to specify which data belongs to which cluster. Can I open an ADO connection as I normally do in other programs from inside the plugin or is there another (easier/better) way to do so ?
Thanks a lot once more.
Best regards,
-Renan Souza
View 1 Replies
View Related
Aug 6, 2007
Hi all of you,
I've got a .dtproj project along with 10 dtsx packages. Up to here everything is fine, every package have its own source files, sql destinations and so on..
Issue comes when I try create a flat file source connection for the eleven one.
I get this message:
The component has detected potential metadata corruption during validation.
Error at Data Flow Task [Flat File Source [1]]: Failed to find any non-special error column in output "Flat File Source Error Output" (3).
It may not be possible to recover to a valid state using a component-specific editor. Do you want to use the Advanced Editor dialog box for editing this component?
Otherwise if I'm gonna to open a new .dtproj project separately no problem at all, I mean, appears the suitable window, "Connection Manager", "Column", "Error output" on the left and so on..
It's very strange. The rest of the packages, the same situation. Fortunately, all of them are stored on the server.
I don't get the point at all. Could you please tell me what the hell is happening?
Thanks in advance and regards,
View 3 Replies
View Related
Oct 16, 2006
http://blogs.conchango.com/jamiethomson/default.aspx has a lot of great tid-bits for SQL 2005. I am currently on a tight deadine for 25 SSIS packages that need to be able to move from Dev to QA to Staging to Prod. For the life of me I cannot get any of the packages to *READ* the config files created with the package config wizard. All I want to do is move the connection string out of the package so we can change the config file and not have to touch (hand edit) each package. Any help is appreciated!
View 13 Replies
View Related
Apr 11, 2008
I was told I can use them with SQLDataSources, but I have no clue how to do it.
I believe I have managed to set up the querry in the datasource correctly, but what do I need to do to actually use it in my VB code?
Any help is appreciated, and any tutorials you've found to be usefull on the subject are sure to help.
Thanks
View 3 Replies
View Related
Apr 2, 1999
Hi Friends
I have a identity column in a table, while adding records,
it fills the column with different values, for eg. 75 after 90.
In which situation, it may occur and how to solve this.
Thanks in advance.
Rajasekar
View 2 Replies
View Related