What are the best options/recommendations and optimizations that can be performed when working with a large MS SQL 2005 table that contains anywhere from 100-200 Million records?
Are there any constants in T-SQL like there are in some other languages that provide the max and min values ranges of data types such as int?
I have a code table where each row has an upper and lower range column, and I need an entry that represents a range where the upper range is the maximum value an int can hold(sort of like a hackish infinity). I would prefer not to hard code it and instead use something like SET UpperRange = int.Max
Hi guys,
I have a project table with the following columns
ProjectID, ProjectDescription
and a list data table which has the following columns
ProjectID ListType Date Memo
Every project has many list type entries in the ListType Table.
What I want to do is run a query which will return something like this
ProjectID, ProjectDescription, ListType1, ListType1.date, Listtype1.Memo, ListType2, ListType2.date, ListType.Memo
Againg, Every Project is coonected to a number of list type data.
I am using Microsoft SQL 2000. so the Pivot keyword doesnot work
In MS SQL is it possible to share an identity seed across tables? For example I may have 2 tables:
Table: PeopleA
id
name
Table: PeopleB
id
name
I'd like for PeopleA.id and PeopleB.id to always have unique values between themselves. I.e. I want them to share the same Identity seed.
Note: I do not want to hear about table partitioning please, only about if it's possible to share a seed across tables.
Hi guys,
I have two SQL Server 2008 databases called Anna and Bob.
Bob has to pull and transform data from Anna to keep updated
his tables.
Ideally Bob will be
always synchronized with Anna,
but some delay would be acceptable.
What is the best way to do this?
Thanks in advance.
I am trying to create some script variables in T-SQL as follows:
/*
Deployment script for MesProduction_Preloaded_KLM_MesSap
*/
GO
SET ANSI_NULLS, ANSI_PADDING, ANSI_WARNINGS, ARITHABORT, CONCAT_NULL_YIELDS_NULL, QUOTED_IDENTIFIER ON;
SET NUMERIC_ROUNDABORT OFF;
GO
:setvar DatabaseName "MesProduction_Preloaded_KLM_MesSap"
However, when I run this, I get an error stating 'Incorrect syntax near ':'. What am I doing wrong?
Hi All,
I have a SQL 2005 TSQL script which sets up my FT Catalog and Indexes, but I would like to also create a Population schedule for these indexes via the same Code, can anyone point me in the right direction.
Thank you
Matt
I have a fairly simple requirement -I have a table with the following (relevant) structure.
with cte as(
select 1 id,'AA,AB,AC,AD' names union all
select 2,'BA,BB' union all
select 3,'CA,CB,CC,CD,CE' union all
select 4,'DA,DB,DC'
)
i would like to create a select statement which will split each "names" column into multiple rows.
For example the first row should produce
1,'AA'
1,'AB'
1,'AC'
1,'AD'
Can we do it using only SQL. This is failry easy to do in Oracle.
Hi,
I just noticed that if I have an identity column in a table, when I insert new rows MS SQL 2008 is automatically filling up the sequence if there are discontinuity. I mean, if in my identity column I have 1,2,5,6 if I insert other two rows in the table the system puts automatically 3,7 in the identity column.
Do you know how to control this behavior?
THANKS
I am using msdb..sp_help_job to access whether a job succeeded or failed and can retrieve a general error.
But, I want to access the specific error for the step that failed. I cannot seem to find it. It is not in this list of helpful stored procedures provided by MS
http://msdn.microsoft.com/en-us/library/ms187763%28v=SQL.100%29.aspx
The account running the query is limited but does have the SQLUserAgent role and owns the Jobs that it is accessing.
i have one database in ms sql server 2005.
i create this long time back, now want to modify it but i lost the password, i remember the user name for that database, is there any way to recover the password for that database or
change its password ?
Thanks
I'm using MS SQL 2008.
Is it possible to create a script to loop over all tables in a database generating a set of index drop scripts and create scripts separately?
What I have to do is drop all indexes on a set of databases to run a heavy data load process but then I want to re-enable all the indexes. I don't want to have to go through each table and script an index drop and then index create.
Thanks!
This is a simple question yet I was unable to find any information at all about this.
Is it possible to have sub-schemas in SQL Server 2005/2008?
Example:
Having a HR (Human Resources) schema with a sub-schema called Training (with tables related to this). It would end up like HR.Training.* where * would be the tables.
Hi,
I have a table which implements a tree using hierarchyid column
Sample data:
People \
Girls \1\
Zoey \1\1\
Kate \1\2\
Monica \1\3\
Boys \2\
Mark \2\1\
David \2\2\
This is the order using hierarchyid column as sort column
I would like to sort data using hierarchyid but also using name so it would look like this:
People \
Boys \2\
David \2\2\
Mark \2\1\
Girls \1\
Kate \1\2\
Monica \1\3\
Zoey \1\1\
Is there a simple solution to do this?
Czy da sie to zrobic w jednym zapytaniu sql ?
How can I create View on Linked Server db. For Example I have a linked server [0.0.0.0] on [1.1.1.1]. Both db servers are SQL Sserver 2005. I want to create View on [1.1.1.1] using table on linked server.
Thanks.
Database has tables Photos and PhotoAlbums. I need query that will select all albums and only one photo from each album. I need SQL and LINQ version of this query. Thanks in advance.
I have to query two different servers from a dynamically built query.
It basically gets data from one server, treats it, and inserts it into another server.
The only problem is I have to be sure it works for both situations:
If both the source and destination databases are on the same server, and if they're not.
I understand the concept of using Linked Servers in SQL Server, but I cannot think of a way to consider both alternatives, same server and different servers.
A little help?
In MS SQL is it possible to share an identity seed across tables? For example I may have 2 tables:
Table: PeopleA
id
name
Table: PeopleB
id
name
I'd like for PeopleA.id and PeopleB.id to always have unique values between themselves. I.e. I want them to share the same Identity seed.
Note: I do not want to hear about table partitioning please, only about if it's possible to share a seed across tables.
I need to rename a databases data file. Is this possible through SQL Server Management Studio?
FYI, I do not have permissions to the underlying box.
Edit: I also need to change the location of the file.
I'm writing a script that is supposed to run around a bunch of servers and select a bunch of data out of them, including the local server. The SQL needed to SELECT the data I need is pretty complicated, so I'm writing sort of an ad-hoc view, and using an OPENQUERY statement to get the data, so ultimately I end up looping over a statement like this:
exec('INSERT INTO tabl SELECT * FROM OPENQUERY(@Server, @AdHocView)')
However, I've heard that using OPENQUERY on the local server is frowned upon. Could someone elaborate as to why?
All,
I am trying to script out a database in SQL Server Management Studio 2005.
In my database users belong to different roles.
Unfortunately I can't find how to script out the relationship between users and roles.
Thanks,
M
I'm trying to transfer some data from Access toSQL Server 2000 (there are no other way to do this sadly), I'm using Access to mssql to do the job. The program fails everytime it finds a datetime in this fashion:
03/07/2009 10.17.00
While it imports date like this:
29/12/2008
I don't understand where this problem come from so I ask you for your help.
Thank you very much.