Questions tagged [sql-server-2008]

Use this tag for questions specific to the 2008 version of Microsoft's SQL Server.

sql-server-2008
Filter by
Sorted by
Tagged with
3 votes
2 answers
3k views

SQL Query for appending rows into destination using SSIS

I have Created a SSIS Package for Importing the Records from One Table to Another table . It is Working Properly But In Source table records are increasing on regular basis . Therefore I am executing ...
kuldeep verma's user avatar
1 vote
1 answer
75 views

Create Job To Convert Data With SSIS

I Want To Convert Data From OldDatabase To NewDatabase Each Day By SSIS. for this: 1- Create Script From Exists New DataBase 2- Change DatabaseName OF Generated Script and Then Execute Script To ...
mehdi lotfi's user avatar
  • 11.4k
70 votes
16 answers
290k views

Convert Time DataType into AM PM Format:

I have one Table which has two fields such as "StartTime" and "EndTime". The DataType of the Two columns are Time. So the Values of the Table looks like as follows: TableA: StartTime ...
thevan's user avatar
  • 10.2k
2 votes
2 answers
4k views

Generate Script In SQL Server 2008 Is Very Slow

Time of Get Script From My Database In SQL Server Management Studio 2008 R2 is about 45:00 Minute. count of tables : 380 Count of views : 89 Count of SP : 109
mehdi lotfi's user avatar
  • 11.4k
4 votes
1 answer
20k views

Cannot connect to SQL Azure using SQL Server Management Studio

I have create a SQL Azure database on the Azure portal, now I want to connect to it using SQL Server Management Studio. I've set my properties like this: Server Type:Database Engine: Server Name:[...
troya_adromeda's user avatar
1 vote
0 answers
294 views

EF4 generated CRUD views having problems with the Create due to parent-child table relationship

I am relatively new to .NET, and am building a website with MVC3, EF4, SQL 2008 R2. Also, I haven't found anything on Stack that directly seems to address my issue, which involves an EF-generated ...
edward_h's user avatar
  • 171
1 vote
1 answer
5k views

SQL Server 2008 Restore a MDF and LDF file [closed]

Background: I had a working database called WBPM which I renamed using the right-click feature in SSMS to WBPM_v20120530 as I wanted to roll out a new version of the database. I believe the right ...
Bertie's user avatar
  • 1,193
1 vote
2 answers
1k views

connection string on virtual dedicated server not working

I'm moving from a shared hosting to Virtual Dedicated Server (both at GoDaddy). Suprisingly, everything went fine up until now. However, now my web application seems unable to connect to the database (...
dsb's user avatar
  • 2,447
-1 votes
2 answers
86 views

Find repeat datetimes within X secs - Returning duplicate times

The query I am using is: SELECT a.What_Tech, a.callid FirstCallid, b.Callid SecondCallid, a.[segStart_dateTime] FirstCallTime, b.[segStart_dateTime] SecondCallTime, DateDiff(second, ...
CodingIsAwesome's user avatar
0 votes
1 answer
241 views

How to Use an Int ID in merge replication

I am going to be using merge replication in SQL 2012 for offline clients who can synchronise their data. The merge replication process adds a guid to each table that is being replicated, but I am ...
peter's user avatar
  • 13.3k
2 votes
1 answer
173 views

A grouping and count select for tabular results in SQL Server 2008

I have 3 tables (one holding results/votes and two are lookup tables) as follows: VOTES areaid - which links to an area table to get area name townid - which links to a town table to get town ...
Dav.id's user avatar
  • 2,757
0 votes
3 answers
5k views

Default parameter values in SQL Server 2008 stored procedure

I want to use a stored procedure that can make some parameters with null value and then test it if the parameter is null or not and do some coding : I just want to know if there is any problem in ...
Yassine edouiri's user avatar
6 votes
7 answers
59k views

Access denied for enabled xp_cmdshell for the admin user

I'm using xp_cmdshell within a database trigger to launch a exe file. xp_cmdshell is enabled(it can execute simple cmd command like 'echo'). But when I try to launch the exe through xp_cmdshell, the ...
Joshua H.'s user avatar
  • 537
0 votes
1 answer
622 views

How to save transformed xml data to sql using GeomFromGML

I have successfully converted a KML file to a GML file using XSLT and now I need to save the GML data to a geometry column in my SQL database. Not sure what to put after this code: var doc = new ...
user1382770's user avatar
3 votes
2 answers
2k views

T-SQL Change Data Capture log cleanup

I have enabled CDC on few tables in my SQL server 2008 database. I want to change the number of days I can keep the change history. I have read that by default change logs are kept for 3 days, before ...
gunnerz's user avatar
  • 1,906
1 vote
5 answers
3k views

Handling blank string ("") text box values when doing select to a database with null values in C#

I'm using a DataGridView to display data from an MSSQL database. I have several text input fields that when an onkeyup event is registered, it performs a lookup query (using a table adapter) with the ...
Davos555's user avatar
  • 2,004
2 votes
2 answers
17k views

Login Failed for user [sql server user]

I am new to SSRS and have deployed several reports. When I force windows authentication, everything works fine, but when I do this: I am getting this error: An error has occurred during report ...
Alex Gordon's user avatar
  • 59.6k
-1 votes
1 answer
727 views

Adding Time Intervals SQL

I need to add time entries from a table. The time entries are stored as P2H30M (2 Hours 30 Minutes) What would be the best way to go about this?
user1287453's user avatar
3 votes
4 answers
5k views

SQL - Finding common rows based on a column (intersect)

Given the following table: InstalledApps MachineName | AppName | Version ------------------------------- machine01 | App01 | 1.1 machine01 | App02 | 1.0 machine01 | App03 | 1.5 machine02 ...
Nasir's user avatar
  • 11.2k
0 votes
3 answers
995 views

Adding Count Column in sql query

I have two table called Production and Chart as below. Production Name Layer CDV TSK CDV USV M1 OSK Chart Name L1_CDV_TSK L1_CDV_TSK L1_M1_OSK I have to produce output like this: Name Layer ...
TNA's user avatar
  • 616
0 votes
0 answers
271 views

SQL Server Query Hint for Fast Rows?

I have a MSSQL 2008 db with a stored procedure that returns a result set with 1-10 rows and 5 columns. I have made all of the optimizations I can think of and my query plans show good index seeks ...
Snowy's user avatar
  • 6,002
2 votes
3 answers
101 views

How do I know whether the value is inserted automatically or needs to be inserted manually?

well I'm using MS SQL Server (mostly working with the Management Studio) and I can't find out how to know what values from a table do I have to insert and what values are created automatically? How do ...
Arturas M's user avatar
  • 4,270
2 votes
3 answers
38k views

Executing a SQL Server Script from a batch file

I have a script that I need to execute using a batch file. Do I use SQLCMD in the batch file to run the script? Also, the script inserts data to a table in a database. How should I format the ...
Blade3's user avatar
  • 4,300
2 votes
1 answer
188 views

I am probably Locking my SQL Server Table by running a SELECT and INSERT and SELECT concurrently

I have a table in SQL Server 2008 R2 that holds "positions" for different companies. I have a function GET_KEY that creates a position number by performing a SELECT MAX over the table. [I can not use ...
gordon613's user avatar
  • 2,852
3 votes
1 answer
834 views

Executing multiple SPs containing BEGIN TRANS - COMMIT TRANS using TransactionScope

What happens when BEGIN TRANS - COMMIT TRANS is done in one SP and Multiple SPs are executed in TransactionScope and error is thrown before completing scope. So pseudo code is as follows //Using ...
IsmailS's user avatar
  • 10.8k
1 vote
1 answer
735 views

Web Service random timeout / dropping connections

We have a windows client application that makes web service calls. The web service can sometimes perform rather long queries on a database. We have 3 production environments where this works fine. ...
creatiive's user avatar
  • 1,083
1 vote
1 answer
193 views

SQL Server 2008 synchronization at 00:00 every day

I have desktop application and I want that all new data in this application that are stored in local DB will synchronize every day at 00:00 to production database. I was looking at the MS Sync ...
senzacionale's user avatar
  • 20.7k
1 vote
4 answers
384 views

Query optimization; Table.Column = @Param OR @Param IS NULL

In WHERE clause when using condition like this Table.Column = @Param OR @Param IS NULL It does not use INDEX on Column. Is it true and if so then how to write this kind of query which also use INDEX ...
Kashif's user avatar
  • 14.2k
1 vote
1 answer
106 views

Unified Login/Account Wrapper for SQL Server and SQL Azure?

I have multiple databases that will exist as an on-premises SQL Server 2012 databases as well as SQL Azure databases. I understand that some variances exist in the way that logins/roles are handled. ...
Snowy's user avatar
  • 6,002
0 votes
1 answer
2k views

select case statement error in mssql

SELECT top 1 case when VR = -99999.99 then 0 else cast((VR*1.732) as decimal(38,3)) end FROM pseb.dbo.datasource where FeederID=5003 order by datetime desc The ...
Saranya Jothiprakasam's user avatar
0 votes
1 answer
664 views

SQL Server Error Message Box on startup

Every time I reboot my machine I see the attached error message. This seems to be a recent occurance since I upgraded SQL Server Express Edition (with advanced services) to SQL Server Developer ...
JsonStatham's user avatar
  • 9,970
1 vote
2 answers
2k views

SQL Server 2008 Query with Multiple Values

I have the following Table in my SQL Server 2008 database dbo.FormEmployment ------------------ employmentID int (PK) formID int (FK) gradeID int employerName nvarchar I wish to create a query that ...
tcode's user avatar
  • 5,085
1 vote
1 answer
213 views

build family relationships between contacts in CRM projects

i want to build family relationships between contacts ,and discover the hidden relaions between contacts and show it using recursion in sql server . for example: i have this table that contains : ...
Haneen's user avatar
  • 23
3 votes
1 answer
2k views

How can I use a WKT as an input to a function?

I have the following where clause in a t-sql statement: where a.CELL_GEOM.STIntersects( STGeomFromText('POLYGON((-25.43623984375 44.257784519021, 21.62918984375 44.257784519021, 21.62918984375 60....
CSharpened's user avatar
  • 12.2k
0 votes
2 answers
980 views

SQL Transact-SQL not working for database name configuration1

I've created a SQL agent job in our SQL Server 2008 that executes the following code: BEGIN SET NOCOUNT ON; declare @database nchar(20); DECLARE Database_Cursor CURSOR FOR SELECT [name] FROM master....
Webberig's user avatar
  • 2,766
1 vote
1 answer
17k views

SQL Server trigger - SET variable = column.value

I'm trying to create a trigger which is operating on table component and logging UPDATE, DELETE and INSERT operation to the table component_history CREATE TRIGGER component_hist ON component AFTER ...
gaffcz's user avatar
  • 3,469
0 votes
4 answers
2k views

Using stored procedure to insert data from selection

I need to insert data into another table using stored procedure that looks something like this: CREATE PROCEDURE T.countnum AS Insert into T1 values(select count(*) from T.countTable) But it isn'...
kinkajou's user avatar
  • 3,688
1 vote
1 answer
552 views

How do I delete the first matching record in Table B for each record in Table A?

Table A contains multiple records that should be deleted from Table B. However, there can be multiple records in Table B that match a single record in Table A. I only want to delete the first ...
papfan's user avatar
  • 191
0 votes
1 answer
589 views

How to give the permissions to sql server 2008 database to insert the data from client system in c# windows application?

How to give the permissions to sql server 2008 database to insert the data from client system in c# windows application(I am able to fetch the data from database in remote server but i am unable to ...
hmk's user avatar
  • 969
4 votes
1 answer
1k views

SQL: Split events into multiple rows

Check out my SQLFiddle here (link) In SQL Server 2008, I have table of event start and end times, like the image below. I need to write a query that allows me to figure out how much of each event ...
Tommy O'Dell's user avatar
  • 7,089
2 votes
1 answer
1k views

count distinct hour from datetime

I am working with sql database, and I have problem. It is about public transportation, and I have table 'Traffic accidents' and column 'Time when accident happened' (datetime). I need to count how ...
Urosh's user avatar
  • 95
1 vote
2 answers
448 views

connecting to multiple sql server databases from java

I have some data to be read from multiple sql server databases (like 200). There will be like 10 tables in each of these databases where I need to read the data from, how can I do this in the best ...
pri_dev's user avatar
  • 11.4k
2 votes
3 answers
14k views

Correlated Subquery inside a join?

I have a query where I need a correlated subquery inside a join. I say need, what I mean is that I think I need it there... How can I do this? My query is below, I get the "The multi-part ...
Faraday's user avatar
  • 2,934
0 votes
4 answers
158 views

What is wrong with my query?

My query (below) doesn't work. I kinda know WHY it doesn't work, but I need help fixing it. Basically I'm trying to do the following: Get all rows from FireEvent Get all rows from HitEvent which ...
Faraday's user avatar
  • 2,934
2 votes
1 answer
5k views

SELECT DISTINCT Extremely slow

I have a query that is taking 48 seconds to execute as follows: SELECT count(DISTINCT tmd_logins.userID) as totalLoginsUniqueLast30Days FROM tmd_logins join tmd_users on tmd_logins.userID = ...
ToddBFisher's user avatar
  • 11.5k
1 vote
2 answers
2k views

How to create a trigger to allow an insert only if what is being inserted is not in a different table

Ok, I searched for the better part of 2 hours earlier today and was unable to find an answer to my question. So I will attempt to see if you all can help me out. So what I want to do is create a ...
Brandon Stout's user avatar
1 vote
0 answers
841 views

Replicating linkedin's databus with SqlServer 2008

I am attempting to recreate linkedin's databus architecture in my organization for a highly contentious database. My initial thought is to use SQL server's Change Data Capture (CDC) functionality to ...
RockyMountainHigh's user avatar
0 votes
2 answers
99 views

How to UPDATE a column from two possible database sources

I have the following scenario: Database A.table A.name Database A.table A.Application Database B.table B.name Database B.table B.Application Database C.table C.name Database C.table C.Application ...
Greg's user avatar
  • 15
1 vote
2 answers
10k views

Execute SQL Server stored procedure with input parameter

Could you suggest please how to execute from Sql Server a stored procedure that receives an input parameter? I tried this but it failed: EXEC GetFilmsInCategory('SF'); The stored procedure is ...
Anna T's user avatar
  • 1,027
0 votes
2 answers
3k views

Updating a blob column in SQL Server

How to update a BLOB column in SQL Server 2008, I am trying to do a pattern match with Like and would like to update the column.
MaverickMan's user avatar

1
763 764
765
766 767
1076