I have a table basically like so
ID | ItemID | Start | End |
---------------------------------------------------------------
1 234 10/20/09 8:34:22 10/20/09 8:35:10
2 274 10/20/09 8:35:30 10/20/09 8:36:27
3 272 10/21/09 12:15:00 10/21/09 12:17:...
MS SQL Server's Money Data Type seems to accept a well formatted currency value with no problem (example: $52,334.50) From my research MS SQL Sever just ignores the "$" and "," characters. ASP .NET has a parameter object that has a Type/DbType property and Currency is an available option to set as a value. However, when I set the paramet...
I created a query that takes a database backup at certain specified location.
I want to use it as a stored procedure but this should act as a global stored procedure so that whenever this SP is called. Then database backup is taken.
It uses DB_Name() to take database backup of owner database.
Is it possible to create any such SP or Fun...
Is it possible to track the ip address of request which update table in sql server 2000/05?
...
Problem:
A Database collumn has a Tristate (0,1,2).
Each of the values are used serversidely.
The Clientcode (which cant be changed anymore) is only able to understand '0,1'.
In the Clients view '1' is identic with '2'. So I want to change the SQL Query in the Database to return '1', if the specific value is > 0.
My current Solution ...
Hi,
I want to select the records from a table which are updated or added in the last one month (table doesn’t have any datetime field and I can’t change the table structure).
Is it possible to write a sql query for that? how to fetch those records from table.
regards,
kumar
...
I have a staging table (stage_enrolments) and a production table (enrolments). The staging table isn't partitioned, the production table is. I'm trying to use the ALTER TABLE SWITCH statement to transfer the records in the staging table to production.
ALTER TABLE dbo.stage_enrolments
SWITCH TO dbo.enrolments PARTITION @partition_num;
...
I'm writing a tool to gather customer configuration information. One of the questions I want to answer, what OS is the customer database running on.
I haven't found a generic way to find the OS with SQL and I can't create stored procedures on the customer's database.
If there is a way, it's probably vendor specific.
Suggestions? Thank...
Given a table (id, col1, col2), does it make sense to create the following indexes:
Index1 (col1) not unique
Index2 (col1, col2) not unique
I am faced with a legacy database that is full of those.
Can I safely delete Index1? Anwser needed for SQL Server and Oracle.
...
I am working on an ASP.NET Online Shop. every products has an entity and even a user sells it, its entity should be decreased.
because this field is shared between all users, it may be negative (because of the shared data problem).
Now, how can I prevent this problem? Can I use transaction for this? If I can, what the isolation level sho...
I have a stored procedure that itself calls a list of other stored procedures in order:
CREATE PROCEDURE [dbo].[prSuperProc]
AS
BEGIN
EXEC [dbo].[prProc1]
EXEC [dbo].[prProc2]
EXEC [dbo].[prProc3]
--etc
END
However, I sometimes have some strange results in my tables, generated by prProc2, which is dependent on the r...
Hi all,
is there a function in SQL Server 2005 that returns NULL [or a boolean value] if any of the arguments (of any type) is NULL, which would save me from writing IF a IS NULL OR b IS NULL OR c IS NULL ....
...
I have two DBs. The 1st db has CallsRecords table and 2nd db has Contacts table, both are on SQL Server 2005.
Below is the sample of two tables.
Contact table has 1,50,000 records
CallsRecords has 75,000 records
Indexes on CallsRecords:
CallFrom
CallTo
PickUP
Indexes on Contacts:
PhoneNumber
I am using this query to find matches ...
In Oracle's PL-SQL, you can declare a variable and define its type based on a table column:
declare var1 table.column%TYPE;
Is it possible to do something similar in MS SQL Server?
I searched but could not find a duplicate for this question. If there is one, please let me know and I'll refer to it and delete this.
...
When I run any query in sql server management studio, I get the following error:
An error occurred while executing batch. Error message is: The file exists.
Restarting SSMS didn't help. Neither did rebooting the machine. The only thing I found on Google was someone saying "report the bug to microsoft" :P
(Windows XP Pro x64, SSMS ...
I have a SQL Server 2005 database used by several applications.
Some users wish to query the database directly from excel. I can understand this, because it is a useful tool for ad hoc queries and then getting the data in a format that's easily transmitted and manipulated by other users.
My question is: Does Excel (say 2003/2007) do i...
Is there any kind of performance hit when querying by placing tables in different schemas in SQL Server.
For instance if I had 2 tables, Table1 and Table2, and put Table1 into the test schema and Table2 into the history schema, and then I tried to link the tables in a query, is this implicity slower than having the 2 tables in the same ...
I have problems filling a temporary table with the resultset from a procedure call on a linked server, in which again a procedure on another server is called.
I have a Stored Procedure sproc1 with the following code, which calls another procedure sproc2 on a linked server.
SET @sqlCommand = 'INSERT INTO #tblTemp ( ModuleID, ParamID) ' ...
Hi there
I use MS Access as a front end to my MS SQL server.
When I use a SQL query in ms Access that is (in my opinion) equivalent to a query I run from the SQL server, Access returns different data. The pictures below illustrate the difference. I use Access 2003 and I have connected the Access table to the SQL server (2008) through O...
Hi all,
in the data warehouse there's a default language for the measures, and I added a translation for German captions. In a Visual Studio Report Server project, when creating a query with my German OS, the cube and its measures are displayed in German language. When dragging measures to the mdx query windows, the default measure name...