sql-server-2008

Applying SSIS Package Configuration to multiple packages

这一生的挚爱 提交于 2021-01-27 23:57:50
问题 I have about 85 SSIS packages that are using the same connection manager. I understand that each package has its own connection manager. I am trying to decide what would be the best configurations approach to simply set the connectionstring of the connection manager based on the server the packages are residing on. I have visited all kinds of suggestions online, but cannot find anywhere the practice where I can simply copy the configuration from one package to the rest of the packages. There

SQL Sort Numeric Strings After Split

感情迁移 提交于 2021-01-27 23:17:39
问题 I currently have char values in a table column which are in the format "IS-" and then 1 to 5 numbers, a possible period with either 2 numbers or a letter following the period. Examples are, IS-1, IS-12, IS-123, IS-123.11, IS-123.a. I need to split the string so that I grab only the number part, sort the strings ASC, and the bring the strings back together the way they were. Explanation. I have the following set of values, IS-1170, IS-1171, IS-1172, IS-1173, IS-1174, IS-870.a, IS-871.a, IS-872

sql ORDER BY clause IN FOR XML

最后都变了- 提交于 2021-01-27 21:10:19
问题 (SELECT t.seccolumnname 'td' FROM DbName.TableName t WHERE t.firstcolumname = 1 ORDER BY t.seccolumnname) FOR XML PATH('tr'), ROOT ('table') It gives me an error : Incorrect syntax near the keyword 'order'. Any ideas and suggestions 回答1: Not sure why you have it in brackets? Try SELECT t.seccolumnname 'td' FROM DbName.TableName t WHERE t.firstcolumnname = 1 ORDER BY t.seccolumnname FOR XML PATH('tr'), ROOT ('table') 回答2: I can say that ORDER BY clause is invalid in derived tables, as you

SQL Server 2008 R2 - sqlcmd bat file to run a batch of sql queries in folder but they are not running in order of file name

人盡茶涼 提交于 2021-01-27 20:16:32
问题 I have a bunch of written sql scripts that I have written and I was looking to run as a batch in order in a folder. After reading up I've resorted to creating a bat file which includes using the sqlcmd. For this particular set of scripts, when i run the bat it doesn't seem to run in order. I have no idea what is going on as I've tried renaming the sql scripts numerically with a prefix number in the beginning, tried using letters, and even renaming the whole script to just a number/letter

Specifying type of String while setting parameter value in Hibernate

匆匆过客 提交于 2021-01-27 19:08:14
问题 I wonder if it's possible to control the type of string (unicode or ANSI) while setting parameter value in the queries generated by Hibernate. The problem is that the most of the tables in my application have varchar/char columns , and these columns are often appear in various filters. However, all queries generated by Hibernate set parameter type to nvarchar/nchar making all indexes built on varchar columns pretty much unusable (index scan or full table scan instead of index seek/lookups ) .

ADODB not passing in parameters

给你一囗甜甜゛ 提交于 2021-01-27 18:54:10
问题 I have a SQL SP with the following parameters... myProc(@param1 AS TINYINT, @sparam2 AS TINYINT, @param3 AS TINYINT, @param4 AS TINYINT, @param5 AS TINYINT, @param6 AS TINYINT, @param7 AS TINYINT, @paramOut NVARCHAR (255) OUTPUT) and I have the following ADODB code in VBA... sVal1 = 1 sVal2 = 1 sVal3 = 1 sVal4 = 1 sVal5 = 1 sVal6 = 1 sVal7 = 1 Dim cnn As ADODB.Connection Dim cmd As ADODB.Command Dim param1, param2, param3, param4, param5, param6, param7, param8 As ADODB.Parameter Dim Rs As

Ordering parent rows by date descending with child rows ordered independently beneath each

偶尔善良 提交于 2021-01-27 12:44:58
问题 This is a contrived version of my table schema to illustrate my problem: QuoteID, Details, DateCreated, ModelQuoteID Where QuoteID is the primary key and ModelQuoteID is a nullable foreign key back onto this table to represent a quote which has been modelled off another quote (and may have subsequently had its Details column etc changed). I need to return a list of quotes ordered by DateCreated descending with the exception of modelled quotes, which should sit beneath their parent quote,

Convert Image DataType To String in SQL Server

谁说胖子不能爱 提交于 2021-01-27 12:36:08
问题 I have a Column having Image datatype in MS-SQL SERVER 2012. I want to get it as string in SQL Query.. I have Tried This: SELECT 'empphoto : '+ ISNULL(CONVERT(VARCHAR(MAX), CONVERT(VARBINARY(MAX), empphoto)),'') from emppersonal where --some condition --empphoto Columns is of Image datatype output looks corrupted (Just 4 characters). OutPut looks like: empphoto : ÿØÿà How can be an Image datatype be converted to string in MS-SQL Server? 回答1: You can extract the image value as BASE64 by

EXECUTE AS USER failed for the requested user dbo in the database

自闭症网瘾萝莉.ら 提交于 2021-01-27 07:31:25
问题 Using sql server 2008. First, I am not a DBA. But I can get around a db when it comes to sp's, triggers, tables, creating and normalizing. I'm a developer. But with this new job, I inherited a large database that has many jobs that run. My predecessor's account was disabled and of course a few jobs started to fail. After searching around and testing and failing, I now need to post for some input on this problem. The job fails when executing a stored procedure and I have checked it. It is

How can I set identity_insert on a tablename passed as a variable

别等时光非礼了梦想. 提交于 2021-01-27 07:22:45
问题 I have the Database name in a @strDBName . I build the SET IDENTITY_INSERT and execute it. There's no error, but a subsequent insert fails. The code below illustrates the problem. Declare @Query Varchar(MAX) SET @Query = 'SET IDENTITY_INSERT '+ @strDBName +'..TableName ON' EXEC(@Query) INSERT INTO [TableName] ... (MAX) Value from another table and other applicable record. SET @Query = 'SET IDENTITY_INSERT '+ @strDBName +'..TableName OFF' EXEC(@Query) 回答1: Just to backup Brad's answer given in