Recently Indexed Messages:-

SQL Server 2012 :: Script For Integer Values Used In A Table

Dec 29, 2014

I'm looking for a script that identifies max values used in a table for all smallints, ints and bigints to determine if they are being used correctly.

View 3 Replies

T-SQL (SS2K8) :: CTE Update Column

Oct 24, 2014

With cte_table (columna)
As (select a from cust)
Update columna
Set a = 'hello'

Question: would a in cust be updated even though the update is to the CTE column named columna? Or would there be an error where the column name must match?

View 2 Replies

Setup And Upgrade :: How To Add Additional Server Instance In Existing Clustered Environment

May 14, 2015

How can i add additional SQL server instance to existing clustered environment on SQL 2005.

View 7 Replies

How To Re Number Integer Field Values In A Table

Sep 22, 2014

I am facing problem with re numbering of field records in a table.I am having one table with below records.

sid(identity/primarykey) stickyId(Integer) UserId(integer)
102 0 171
103 1 171
104 2 171
105 3 171

here how to renumbering stickyId values when deleted particular stickyId from UI. Here stickyId field is Integer type only. not primarykey/identity field.

View 3 Replies

SQL Security :: How To Find Who Alter Database User Access Changes In Server

Oct 6, 2015

someone was alter user  databases owner access.

how to find  who alter evoke  the database user access changes in sql server.

View 5 Replies

SQL Server 2008 :: Generating Dates At Runtime

May 29, 2015

I am trying to generate dates for a roster dynamically in a stored procedure. If my start date is '01/01/2015', end date is '12/31/2015', I should generate dates from '01/01/2015' adding 7 days.

The output comes like this:

until end date

I do it through loop but just posting it here to know, if there is any other efficient way using CTEs or some sort of queries which can avoid loop in SP.

View 7 Replies

T-SQL (SS2K8) :: Finding Previous Even Numbered Month And Appropriate Year From Given Date

Mar 25, 2014

I'm trying to write some T-SQL to return the previous even numbered month and appropriate year from given date.

Examples given:
03-25-2014 should return 02-xx-2014
01-01-2014 should return 12-xx-2013

View 2 Replies

Master Data Services :: Leaf Attribute Imported From MDSModelImport Not Appeared To Explorer

Aug 25, 2015

Env: SQL Server 2012

I'd like to import some tables into MDS entities.

So I found MDSModelImport Program.

Importing is worked. And I confirmed to imported columns of tables as leaf Attributes.

I tried to insert data. But In Explorer Leaf Attributes are not shown except Code and Name.

So I couldn't insert data. In Excel also it does.

View 3 Replies

Reporting Services :: Report Builder - Set Parameter To Include Or Exclude Columns From Data Presentation

Oct 2, 2015

Based on a table like below I have created a report so that I can compare number of items in the main warehouse (LOCATION1) and the outlets (LOCATION2 and LOCATION3).

| 1  | INDEX1             | LOCATION1 | 1         |
| 2  | INDEX1             | LOCATION2 | 1         |
| 3  | INDEX1             | LOCATION3 | 0         |
| 4  | INDEX2             | LOCATION1 | 0         |
| 5  | INDEX2             | LOCATION2 | 0         |
| 6  | INDEX2             | LOCATION3 | 1         |
| 7  | INDEX3             | LOCATION1 | 1         |
| 8  | INDEX3             | LOCATION2 | 0         |
| 9  | INDEX3             | LOCATION3 | 1         |

The way I present data in my Report is as such. I want to show items that are available in the warehouse that should be moved to the outlets.


[Code] .....

| INDEX1               | 0                              | 1                               | 0                             |
| INDEX2               | 1                              | 0                               | 1                             |
| INDEX3               | 1                              | 0                               | 1                             |

I have added some parameters in my report to filter out products that are not available in warehouse (LOCATION1) and this works great.

select * from VIEW where 'LOCATION1(VALUE)' > 0 and ('LOCATION2(VALUE)' = 0 or 'LOCATION3(VALUE)' = 0)

| INDEX1               | 1                              | 1                               | 0                             |
| INDEX3               | 1                              | 0                               | 1                             |

Now the issue starts when I add a parameter to my report for user to choose which outlets (LOCATIONs) he wants in the equation. I know how to make a column disappear based on parameter value but how to take it out of equation? At the moment when user selects only LOCATION2 and not LOCATION3 then data is not filtered correctly:

| INDEX1                 | 1                              | 1          |
| INDEX3                 | 1                              | 0          |

Ideally I would like a user to select random outlets (warehouse would be static on the report) and compare one or multiple and only show records that are 0 in the outlets.

View 2 Replies

Setup And Upgrade :: 2005 Backup To Restore Into 2014 Enterprise

Jul 7, 2015

We successfully restore 2005 backup into SQL 2014 , so does that mean , does it  mean all are ok ? or we have to do something next ? 

View 6 Replies

T-SQL (SS2K8) :: Average Number Of Days Between Orders

Apr 7, 2015

I need to calculate the average number of days between customer orders.

My table has customer number and order number and the order date.

I would like to end with customer number last, order date and the average number of days between orders for each customer.

HOLLGCAB 119482 02/27/2015
JILCO 119484 02/27/2015
KEY 119491 02/27/2015
TURNER 119496 02/27/2015
KEY 119499 02/27/2015

[Code] .....

View 9 Replies

Transact SQL :: Date Value Between One Of The Calendar Periods In Multiple Rows?

Aug 20, 2015

Question: How to determine if a date value was between one of the date periods that appear in multiple rows?

Background: We have a table of "license valid" periods, wherein each license can have one or more rows.  (As you know, a driver's license can be started, expired, renewed, suspended, reinstated, revoked, etc.)  Instead of of having a license activity table--from which valid license periods could be extrapolated--we store just the periods for which a license was valid.

My task is to take a list of licenses and specific dates and determine if each license was valid as of that date, returning either true or false.  What is the best way to accomplish this?

DECLARE @ValidityInQuestion TABLE (
LicenseID int
, DateValidityInQuestion date);

DECLARE @LicenseValidPeriods TABLE (
LicenseID int
, BeginDate date
, EndDate date);

[Code] ...

 How then do I query both tables in order to get the same result that results from the following query?

12345 AS LicenseID
, '2015-01-15' AS DateValidityInQuestion
, 1 AS LicenseActive
, '2015-02-04'
, 0;

I assume I need to join on the LicenseID columns, but my understanding stops there.

View 4 Replies

Getting Access Is Denied

Sep 29, 2015

I've started getting an issue with this command..It's trying to access a specific directory and I am getting 'Access is Denied'..Something has been changed in the last couple of weeks and I'm not sure what it is

I suspect that security on the folder has been amended..How do I find which account xp_cmdshell runs as so I can go to our networking department and have them check the AD account?

View 1 Replies

Integration Services :: Failed To Open A Fast Load Rowset

Aug 28, 2015

i got a error [OLE DB Destination [16]] Error: Failed to open a fastload rowset for "[dbo].[tempMaster]". Check that the object exists in the database.

i am creating and doping this table in beginning after insert/update i will drop this table but this is error.i am using sql server 2008R2

View 2 Replies

Transact SQL :: Global Temp Tables

Jun 3, 2015

I have two global temp tables in my stored procedure.Is it possible for me to make the execution of a stored procedure dynamic. Based on a flag parameter value I should get the result set from first temp table  and viceversa ex: If my flag is 0.I should be able to get the result set from ##temp1 (select * from ##temp1).If my flag is 1.I should be able to get the result set from ##temp2 (select * from ##temp2).

View 4 Replies

Copyrights 2005-15, All rights reserved