sql-server

User input registration then geocoded into database

I've been having quite a bit of trouble with Google Maps API and a database driven map. In a previous question I had inquired about faster geocoding of addresses to a map and basically what I need to do is store Lat/Lng into the database and create a map from there, instead of geocoding while the map is loading. However, I'm unsure exac...

Creating tables in SQL Server 2005 master DB

I am adding a monitoring script to check the size of my DB files so I can deliver a weekly report which shows each files size and how much it grew over the last week. In order to get the growth, I was simply going to log a record into a table each week with each DB's size, then compare to the previous week's results. The only trick is ...

TableCardinality

Hi, in MS SQL 2010 What does it means TableCardinality in execution plan? I am looking at data base tuning performances Thanks ...

I need to improve my T-SQL query so that i can return the sum of columns

Here is my current query: SELECT patron_name, producer.federal_number, hst_number, average_bf_test, (SELECT MAX(s.statement_number) FROM statement s) AS statement_number, (SELECT MAX(s.period_ending) FROM statement s) AS period_ending FROM producer JOIN producer_details ON producer.federal_number = pro...

SQL Server Profiler - Evaluating Reads. What is considered 'good' or 'bad'?

I'm profiling (SQL Server 2008) some of our views and queries to determine their efficiency with regards to CPU usage and Reads. I understand Reads are the number of logical disk reads in 8KB pages. But I'm having a hard time determining what I should be satisfied with. For example, when I query one of our views, which in turn joins wi...

Sync Provider for SQL Azure

Hi, I am looking for SQL Azure specific provider that seems to be published by Microsoft. I downloaded the sync tool given at http://www.microsoft.com/downloads/details.aspx?FamilyID=bce4ad61-5b76-4101-8311-e928e7250b9a&displaylang=en but it contains a sync wizard. I need to implement a lot of custom synchronization logic to synch...

Delete from Database without postback - Want to animate the disappearing item that is deleted

I have a site that show infomation that are contained in div blocks. The info is taken from a database so the user can change the info or delete it. When the user deletes a div block i want to use jQuery to animate that its disappearing and also that its deleted from the database. How can i do this without doing a postback, i dont wan...

SQL Set variable with single column in select field

I have a column along with many others that returns a int value. It is the same int value for every record in this column. If this value is 1 I need to set a variable = 1 if it is 0 i want the variable to be 0. How do I go about doing this? There can only be a 0 or 1 in that column. And again it is the same throughout the entire column...

Access 2003 and SQL Server Backend - Which datatype for currency?

I have an Access 2003 front-end that has data stored in a SQL Server backend database. I want to store monetary values (i.e. $1,3456.25) but I am not sure which datatype to use when going between SQL Server and Access. On the SQL Server side I figured Decimal (18,2) would be good to use as I only need a scale of two (two places to the ri...

translate from SQL Server to Oracle

I was hoping one of you Oracle experts would be able to give me a hand with this. I have the following SQL Server script, but I need to rewrite it for Oracle: USE mydb GO SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO CREATE trigger mydb . [CONNECTERTRIGGER] on mydb . [DtreeNotify] FOR INSERT AS BEGIN IF @@ROWCOUNT=0 RETURN SET I...

Using Linq, Trying to Use OrderBy on Object's Children

Hi All, Trying to use Linq with some Entity objects to do a crafty query here. Hoping for some help with a point I'm having a hard time finding decent documentation on: Basically, I'm trying to use OrderBy to order against the child of an object I'm querying against. The difficult part is that the object has multiple children, and base...

Suggested replication type?

I have 2 similar tables in different servers, data in certain columns can only be changed by server A while data in other columns can only be changed by server B. However, I need these tables to always be consistent (1 minute schedule). Is this the kind of scenario that "Transactional replication with updatable subscriptions" solves? ...

Create synonym to all tables in a different database with a script

Hi SQL Server gurus, Is there an easy way to create synonyms to all tables in a different database? thanks EDIT: I have a number of stored procedures that hardcoded some table schemas into the select queries. When I copy the schemas to a new server, the SPs fail because the schema doesn't exist. There is little control I have over the...

Which approach is better for this scenario?

Hello SQL Gurus. We have the following table: CREATE TABLE [dbo].[CampaignCustomer]( [ID] [int] IDENTITY(1,1) NOT NULL, [CampaignID] [int] NOT NULL, [CustomerID] [int] NULL, [CouponCode] [nvarchar](20) NOT NULL, [CreatedDate] [datetime] NOT NULL, [ModifiedDate] [datetime] NULL, [Active] [bit] NOT NULL, CONST...

INSERT INTO and DELETE... IF/WHERE a column in different table

What statement can I use to INSERT INTO tableA a new row ONLY IF a specific column in tableB equals some value, where tableB contains "itemid" and tableA includes "itemid" as well. I thought of INNER JOIN but is that possible somehow? I also need exactly the same approach for DELETE. ...

tsql Loop with external query

I am looping through all my databases and aggregating the results into an aggregates database. In my loop I call master.dbo.xp_cmdshell osql C:\whatever.SQL As the loop progresses, the cmdshell takes longer and longer to execute. If I stop the loop and run a single aggregate for one database it executes quickly. Is there anything...

How to get a list of all the MS SQL Server instances on the local machine?

This seems to be a fairly common question, but none of the answers I've seen have been particularly satisfactory. I want to get a list of the names of the MS SQL Server instances installed on the local machine, regardless of whether they're started or not. For the purposes of this discussion, I'm OK with just finding instances of SQL 200...

how can I delete date in this table ?

I have table like this create table tbl_1( year int, month int, day int ) insert into tbl_1 values(2009, 11, 30) insert into tbl_1 values(2010, 3, 4) insert into tbl_1 values(2011, 5, 13) insert into tbl_1 values(20011, 12, 24) I want to delete date from 2009-11-30 until 2011-5-13, but I can't because all of columns are i...

How are these tasks done in SQL?

I have a table, and there is no column which stores a field of when the record/row was added. How can I get the latest entry into this table? There would be two cases in this: Loop through entire table and get the largest ID, if a numeric ID is being used as the identifier. But this would be very inefficient for a large table. If a ra...

SSIS - creating a custom connection manager

Anyone aware of guidance on creating a custom SSIS connection manager? I want to abstract the complexities of a source system for the folks that need to extract data out of it using SSIS. ...