Tagged Questions
3
votes
1answer
41 views
Convert SQL Server 2012 SSIS package to 2008
I've created a few SSIS packages in SQL Server 2012 that I need to run on SQL Server 2008. I've been told that it is impossible in their current state.
Is there a way to convert the 2012 packages to ...
3
votes
2answers
60 views
Backup very large table
I'm deeply sorry if this is an amateurish question, but I have to update certain values of a large table (for the sake of a presumed example, it is called 'Resource' and it is over 5M rows) and thus I ...
4
votes
2answers
66 views
Should I use a composite or single-column index?
I have the following columns in my database table (Medicines).
ID bigint,
MedicineName nvarchar(50),
BrandName nvarchar(50),
MedicineCode nvarchar(20),
and price,quantity.
I am making a stored ...
4
votes
1answer
387 views
CTE memory space
How do CTE memory space work? When you have complex SQL statements executing with the CTE and you get unusually large result set, can it increase the logical reads of the query?
I have a CTE that is ...
-1
votes
1answer
51 views
Single quote issue
I have to update a column where I am giving query which is
Update Table
Set col = '[189] IS NOT NULL and [189] <> '''
Where colid= 198
But it's giving output:- [189] IS NOT NULL and ...
0
votes
2answers
54 views
Running a query within a scheduled job
I am looking at running the following query within a scheduled job weekly:
Select TOP 10
s.database_name,
m.physical_device_name,
CAST(DATEDIFF(second, ...
-2
votes
3answers
66 views
Left Join not giving desired result
I have two Datasets
FEES PAYMENTS
CrsCode InstNo FEE Regno CRSCODE Instno Payment
CA1 -2 100 R1 CA1 -2 100
CA1 -1 200 ...
-1
votes
0answers
28 views
Using If statements in stored procedure breaks it [migrated]
This is my stored procedure:
USE [Hires_new]
GO
/****** Object: StoredProcedure [dbo].[ps_selectNewHireWorkPeriodsSQL] Script Date: 05/14/2013 12:59:28 ******/
SET ANSI_NULLS ON
GO
SET ...
0
votes
0answers
20 views
How to merge a select statement with a calculated value as new columns? [migrated]
In my sql server code, I have this select statement
select distinct
a.HireLastName,
a.HireFirstName,
a.HireID,
a.Position_ID,
a.BarNumber,
a.Archived,
...
0
votes
0answers
40 views
How to loop through a select statement? [migrated]
I have this select statement
declare @t table (Percentage float)
DECLARE @acc INT
SET @acc = 1
DECLARE @max INT
select @max = max(HireID) from NewHire
WHILE (@acc <= @max)
BEGIN
IF ...
-1
votes
2answers
56 views
How to do division from select statements in sql server?
I am trying to create a select statement that can return a table of 1 column.
Basically, I am looping through all the records of NewHire, and then using its id, to select stuff from another table. I ...
2
votes
1answer
63 views
Reorganize full text catalog is offline or online?
I need to schedule a Full Text Search Maintenance and I was reading this link: http://msdn.microsoft.com/en-us/library/ms176095.aspx. Reading this documentation I am supposing that I need to ...
3
votes
3answers
91 views
Fixed length text file insert into SQL table
I am not a DBA on this one and I will not have access to BCP or anything like that. So I'm wondering if there is still a way to do it in SQL keeping it very basic.
I have 100's of text files that ...
-1
votes
1answer
61 views
Validate each parent intermediary is also a parent to itself
I have a table for which I want to validate where each parent intermediary is also a parent to itself. How to write query to validate this?
COLUMN DATATYPE DESCRIPTION
...
-1
votes
1answer
57 views
How to merge data from 2 databases [duplicate]
I have a SQL-Server database that crashed while I was away on vacation. All info from 5/2/13 is missing from our current database because my replacement implemented a back-up of the database from ...
3
votes
1answer
40 views
Scheduled stored procedure on all databases in my server
On SQL Server 2012 (not express edition) I'd like to schedule the execution of a stored procedure every hour.
On the same server I have lot of databases with the same structure, and I'm constantly ...
0
votes
0answers
77 views
how to find similar word with more similarities
how to Find words with length less than or equal...
declare @inp nvarchar(max),@data nvarchar(max)
set @inp='You can dance, you can jive, having .... jove... jve, ...'
set @data = 'jeve'
...
0
votes
3answers
79 views
How to find all positions of a string within another string
How can I find all the positions with patindex in a table or variable?
declare @name nvarchar(max)
set @name ='ali reza dar yek shabe barani ba yek '
+ 'dokhtare khoshkel be disco raft va ali ...
-2
votes
2answers
66 views
Export complete database to a remote server including (Tables, Stored Procedures, Triggers)
How do we "export" a complete Microsoft SQL server database from one server to a "remote" server (including all the "stored procedures" and "triggers"). The export facility provided in the management ...
1
vote
2answers
77 views
Saving a SQL Server database to a file and opening it on another server under any database name
I am trying to find an efficient way of being able to physically save and open a SQL Server database like how it's done with Access. I would like to be able to save my entire database into a file ...
-4
votes
1answer
42 views
Update date Column values? any please help? [closed]
I Want to copy and data in same Table and Update date Column values? any please help?
1
vote
1answer
54 views
How do I refresh SQL server cross database references after a database is reattached with a different name? (Are there hidden synonyms?)
I have 2 seperate SQL databases on the same SQL instance. Database1 references tables on Database2 in its views and stored procedures. Everything was working fine until we had to create a fresh ...
2
votes
1answer
66 views
Backing up SQL Server 2008 database in different recovery model
We currently have a production environment with 10 SQL Server 2008 databases in Full recovery mode (for obvious reasons). We back these databases up fully at a frequent interval, but due to the Full ...
1
vote
1answer
51 views
Can I use Try_Cast to give me a query result column with different datatypes?
I have a column that is varchar(max). It contains mostly valid XML. But sometimes it has invalid xml (that I still need).
I am trying to make a view for this table that allows the value to display ...
0
votes
1answer
19 views
“Replicate” sql structure between testing and staging on same database instance
On my local development server I have a database set up which gets hooked into Entity-Framework and is then used for unit testing. Let's call it COMPANY\Database
On the same server (and same database ...
1
vote
1answer
66 views
The job failed. The owner (pc\user) of job FULL DB BACKUP does not have server access
SQL Server 2008R2 is failing to execute log backup hourly.
Date 5/2/2013 10:22:19 PM Log Job History (LOG BACKUP)
Step ID 0 Server pc Job Name LOG BACKUP Step
...
2
votes
1answer
49 views
What are the risks for logging across databases via a trigger?
I've searched for this online and had mixed or unclear responses, and after posting on superuser, was directed over here.
On SQL Server 2005, we currently log certain table changes via triggers using ...
0
votes
4answers
86 views
Database Restore Failed Due to Incompatible Version of SQL Server [duplicate]
I am working on different two SQL Server , I need to transfer database from one server to another but problem is both server has different version.
Below is Image of Error message.
Using SELECT ...
7
votes
3answers
327 views
Worse performance on a new server
We've been on a dedicated server (single quad-core, 6 GB RAM) and are moving to a new dedicated server (2x hex-core, 32 GB RAM). Both are Windows Server 2008, SQL Server 2008. The performance on the ...
2
votes
1answer
42 views
Create SQL Script for Statistics
I wanna create script my whole table, including all statistics and indexes.
In SSM, When I right click table and create script, it gives me script for Indexes for not for statistics.
If I right ...
-1
votes
3answers
99 views
Add Contents in a Column and make them 0 [closed]
http://sqlfiddle.com/#!3/96f11/3
In the above fiddle, I need the required output in the Fiddle.
ie., The UserID column in Filtered Table and Main table are equal.
I need to get the Amt column data ...
1
vote
2answers
45 views
How to create trigger on database that 'triggers' when mirroring role changes from mirror to principal
I want to perform some sql when my database mirroring state changes
3
votes
1answer
39 views
tempdb logs on same drive as tempdb data or with other logs?
For many reasons I only have 3 hard drives (RAIDed and in an Always-On AG) for all my database files:
D: Data
E: Logs
F: Tempdb
Should the tempdb log file go on F: with the data file(s) or on E:?
...
0
votes
1answer
91 views
Login failed for user 'domain\username'. (Microsoft SQL Server, Error: 18456)
I am facing this problem when connecting to local system db, but when i connect any server it connects.
Login failed for user 'domain\username'. (Microsoft SQL Server, Error: 18456)
For help, click: ...
4
votes
2answers
82 views
Extract part of string based on nth instance of character
I am trying to find a way to extract part of the strings below. I need everything between the 6th and 7th \ character.
\\fileServerA\d$\LiteSpeed\Wednesday\ServerA\Tlog\DBA1_TLOG_20110504_0333.SLS
...
2
votes
2answers
72 views
Using T-SQL to dynamically create Extended Properties
I would like to add Description and Status in the Extended Properties of a large database to all my tables and columns so that someone can fill in the values.
It would be very laborious to add these ...
0
votes
2answers
25 views
Running a Job from a Stored Procedure in another server?
How can I run a job from another server using a stored procedure?
Let's say
server 1 : db1
server 2 : db2
username : testssis
password : testssispass
sqljob found in db2: job1
Here is the part ...
3
votes
2answers
75 views
Error while taking backup using SSMS
I am using SSMS. I have about 5 logins. For a particular login I have all server roles other than sysadmin. It is a sql login (not windows authentication). In user roles it has all permission for ...
1
vote
1answer
61 views
Paging in SQL Server 2012 vs. previous versions
I have used lot of paging code in SQL Server 2008. The format is
With CTE(
-- SQL With RowNumber
)
-- SELECT ALL Page N
This is working fine. But I have heard that SQL Server 2012 has better ...
0
votes
0answers
48 views
Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON' [closed]
I have 4 SQL Server 2008 instances from which I need to pull data using OPENROWSET. I am adding this data to a table on server 1. Server 1 and 2 are in a cluster, same as 3 and 4. I am remoted into ...
1
vote
1answer
43 views
How can I identify the number of times a View is called in SQL Server?
How can I identify the number of times a View was called in SQL Server?
I am looking for an answer that is similar to this below which shows how it can be done for stored procedures.
How can I ...
0
votes
3answers
118 views
T-SQL Issues With Defining 'AS'
I am creating a fully dynamic application but have ran into a bit of a hiccup. There are multiple 'undefined' fields that can be defined by the users. The only problem is redisplaying them. Currently ...
2
votes
2answers
77 views
Identity proceeds as normal, but with a leading 10…?
So I noticed a very strange thing when tinkering with my database.
I had just inserted a row which was ID 47, then after inserting some more, I realised that somehow my Identity had skipped all the ...
0
votes
3answers
93 views
Is transaction log lost after backup on SQL Server?
I have database that has regular nightly backup (full recovery, full backup). I noticed some irregularities in data and wanted to check out transaction log to see what happened. I restored earlier ...
1
vote
1answer
71 views
How to enhance the SQL query performance for thousands and millions of huge data
Now Our team are involved in a forum data analysis project. Its target data is so huge(I think). We should find the potential informations from it. Such as the popular products,the customers ...
6
votes
1answer
101 views
LATCH_EX Waits on Resource METADATA_SEQUENCE_GENERATOR
We have a process that generates an inventory report. On the client side, the process splits of a configurable number of worker threads to build a chunk of data for the report that corresponds to one ...
2
votes
1answer
90 views
Update “NULL” string to Actual NULL value
I have a table that contains NULL values but the problem is that some of the values are actually string "NULL" and not actual NULLS so when you trying something like
where date is null
it will not ...
0
votes
2answers
43 views
How to write a script to push the server time to out?
Background:
I am programming a database in Ms-Access and using SQL-server as the Back-end. But since my database will be a multi-user platform I need to make sure that whenever a user is posting data ...
0
votes
2answers
53 views
Only allow one checked row in a Column in SQL Server [duplicate]
Background:
I've only just begun programming in SQL... barely begun even. But I have been thrown into the deep-end left to find a way and learn to program SQL.
Question:
Is is possible to have a ...
1
vote
1answer
37 views
Moving one TempdB on 3 instance server
I have a large virtualized SQL Server (Full 2008R2).
I run 3 SQL instances and would like to relocate the TempdB database file to another location, splitting off from the TempdB log file.
The trouble ...


