I need to be able to export the data from a table to a text file using sqlcmd. I need to be able to use Ctrl-A as a column separator. Is this doable, and if so, how? I am assuming the this is a value used by the -s option.I need to use a batch file to run the sqlcmd utility.
We have a suppliers application that runs a stored procedure (one ofmany). This stored procedure then calls various other ones etc... andthe final number of stored procedures run is 11.Now, some of our users have been having problems and deciding forthemselves to CTRL+ALT+DEL the application. This is the first thing wewill stop.However, we have had some error messages indicating that the previoustransaction is blocking them when they try it again. This leaves theuser blocking themself. Guess what they do next ? ******* ! :-)I'm assuming that SQL is stuck at some point in the 11 SP's used.When you cancel a query or stored procedure and SQL rolls back thetransaction, it may take a while to do this. Fair enough, but how doesit handle it if multiple transactions are to be rolled back ? Forexample.A calls B which calls CA gets cancelled. What happens to B and C ? (assuming A has finishedthe call to B but not finished the remainder of the SP i.e B and/or Care still running).Is there any way I can identify where it has failed (bit of a longshot I know)?Does SQL take the users permissions when running stored proceduresfrom within other stored procedures, or does it use their permissionsfor the first one and SQL Server handles the remainder ? I know thefirst one will use the users permissions, but does this carry onindefinately ?Any advice / help would be appreciated.ThanksRyanp.s. SQL 7 running on Windows 2000 Server / Windows 2000 PC's.
Hi Guys, I have a SQL block which I want to run based on some values in the DB ----------------- I am implementing the check as follows.. --------------------- PRINT 'Checking the DATABASE name and Schema Version '
SET NOCOUNT ON CREATE TABLE chkversion (table_name VARCHAR(30), id INT, reason varchar(200)) GO
DECLARE @MSG CHAR(1) print @MSG GO
/* Make sure user is running the right script and right db user */
declare @ver varchar(100), @username varchar(100), @cnt int begin select @ver = value from propertytable where id = 33086 select @cnt = count(*) from propertytable where parentid=5001 and propertyid = 726; select @username = db_name(dbid)from master.dbo.sysprocesses where status ='runnable' insert into chkversion (table_name, id, reason) values ('', -1, 'You are logging on Database - ' + @username) insert into error_report (table_name, id, reason) values ('', -1, 'Your agile database version is ' + @ver) if (@ver != '9.0.144'or @cnt !=0) begin insert into chkversion (table_name, id, reason) values ('', -1, 'STOP: Your Schema Version and/or database version are not at original 90SP2. Please abort!') end else insert into chkversion (table_name, id, reason) values ('', -1, 'PROCEED: You can run this script to upgrade your db schema from 9.0.144 to 9.0.178') end GO
DECLARE @MSG CHAR(200) SELECT @MSG = convert(varchar(255), reason) from chkversion where id = -1 print @MSG GO
DECLARE @MSG CHAR(1) print @MSG GO SET NOCOUNT OFF ---------------------------------------------------------- After this, I want user to press 1 to continue or CTRL +C to abort based on the output message from above. How Do I implement this feature? In Oracle, I use... Accept agproceed number prompt 'Enter 1 to continue or CTRL C to abort.';
I am working on an application that uses ADO to retrieve data from SQL Server 2005. It may be used against various instances of databases and each instance contains floating point values that may used comma (',') or point ('.') as decimal. This is where the problem occurs. Depending on the database instance the strings containing floating point values also use comma or point as decimal separator.
Is there a way that by which I can force the database to return floating points with decimals separated by point? Doing a prelimimary google search, I found hints of including "Locale Identifier" in the connection string such as
I need a help in SQL Server 2000. I am having a string variable in the format like -- (1,23,445,5,12) I need to take single value at a time (like 1 for 1st, 23 for 2nd and so on) from the variable and update the database accordingly. This is like a FOR loop. Can anyone help me out in splitting the variable using the comma separator...
I'm trying to import a semi-comma separated text file into a SQL db. I have a field in the text file that contains decimal number. As a decimal separator it's used a comma (15,35). When i use a DTS package to create a destination table and import all rows, the field is created as a float field. In this field the decimal comma is removed so the number in SQL becomes 1535. If I change the decimal separator to (.) i works OK. But I need to get it work with comma as decimal separator. In the DTS package the field form the text file is recognised as varchar (8000). Any ideas?
Can the same result be achieved sending as attachment with dbmail?
EXEC msdb..sp_send_dbmail @attach_query_result_as_file = 1I don't want to have to add column names as part of the query
Change the query to return column headers in resultset SELECT 'CustID' as f1, 'name' as f2 UNION ALL SELECT CAST(CustID as Varchar(10)), name FROM tblCustand set
I have a database field which consists of a long string of values with some separator.
Ex:Â Injection^!@$#Medication
in my report i have to split the string as
Injection Medication
till here i am able to display the results but in addition to that i have to display check box against these values like below
and this string can contain any no of values ex: if we have 4 values are separated within a string then i have to display 4 check boxes against 4 results.
I am using Excel 2013 64bit and use an english Excel version, but with a comma as a decimal seperator and semi-colon as a list seperator.
In Excel everything works fine, but PowerPivot does not properly recognize that I use a semi-colon for formulas.
PowerPivots lets me write formulas with the semi-colon and not the comma, so that is fine.
However, two issues appear:
the yellow smart formula help box that appears when you start typing a formula, thinks I have to use commas, so when I use semi-colons instead, it does not jump to the next parameter.This problem also causes parameters where I have to enter a table or field to not suggest me table and fields when I start typing.Sometimes the formula validation even throws me an exception, that my formula syntax is incorret, ebcause Id id not use a comma. However, commas also do not work. I have to do some weird playing around until it finally accepts my formula.
I hope this buggy behaviour gets fixed, but is there a way I can work around this without changing my formula/list seperator? I also do not want to use a German Excel version, because I am used to the english formulanames.
I have a excel file which has a column called "Code" and their values are A,B,C,D,E,F,G,H. I want to create a new column called "status" based on the values of "Code".
Code:
A B C D E F G H
If A,C,E,G then "status" = "Active" else if B,D,F,H then "Status" = "Inactive". I like to do it using "Derived Column".
The requirement is to have a table say 'child_table', with an Identity column to refer another column from a table say 'Parent_table'..
i cannot implement this constraint, it throws the error when i execute the below Alter query,
ALTER TABLE child_table ADD CONSTRAINT fk_1_ct FOREIGN KEY (child_id) REFERENCES parent_table (parent_id) ON DELETE CASCADE
the error thrown is : Failed to execute alter table query: 'ALTER TABLE child_table ADD CONSTRAINT fk_1_ct FOREIGN KEY (child_id) REFERENCES parent_table (parent_id) ON DELETE CASCADE '. Message: java.sql.SQLException: Cascading foreign key 'fk_1_ct' cannot be created where the referencing column 'child_table.child_id' is an identity column.
Hi guys, If I have a temporary table called #CTE With the columns [Account] [Name] [RowID Table Level] [RowID Data Level] and I need to change the column type for the columns: [RowID Table Level] [RowID Data Level] to integer, and set the column [RowID Table Level] as Identity (index) starting from 1, incrementing 1 each time. What will be the right syntax using SQL SERVER 2000?
I am trying to solve the question in the link below: http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2093921&SiteID=1
Thanks in advance, Aldo.
I have tried the code below, but getting syntax error...
ALTER TABLE #CTE ALTER COLUMN [RowID Table Level] INT IDENTITY(1,1), [RowID Data Level] INT;
I have also tried:
ALTER TABLE #CTE MODIFY [RowID Table Level] INT IDENTITY(1,1), [RowID Data Level] INT;
Hi I’m trying to alter a table and delete a column I get the following error. The object 'DF__Morningst__LastU__19EB91BA' is dependent on column 'LastUpdated'. ALTER TABLE DROP COLUMN LastUpdated failed because one or more objects access this column. I tried deleting the concerned constraint. But the next time I get the same error with a different constraint name. I want to find out if I can dynamically check the constraint name and delete it and then drop the column. Can anyone help.IF EXISTS(SELECT 1FROM sysobjects,syscolumnsWHERE sysobjects.id = syscolumns.idAND sysobjects.name = TablenameAND syscolumns.name = column name)BEGIN EXECUTE ('ALTER TABLE tablename DROP CONSTRAINT DF__SecurityM__DsegL__08C105B8')EXECUTE ('ALTER TABLE tablenameDrop column columnname)ENDGO
I am trying to exclude records from a table where the ID column is the same but the Mail code Column is multi-valued.For Example: (the table looks like....)
Hi, I have dates in "mmddyy" format coming from the sources and they are older dates of mid 80s like 082580 for instance.
When I cast it this way (DT_DBTIMESTAMP) Source_Date , It says ok but throws a runtime error.
When I hardcode a date in same format, (DT_DBTIMESTAMP) "082580" , It becomes red (an indication of syntax error) . Please note that we use double quotes in expressions in Derived Column Transformation; So an anticipation that using double quotes over single ones would be the syntax problem would be wrong.
I am creating a report in SSRS which has the following criteria:
- Row 1 (parent) is 'Product'
- Row 2 (child) is  'Feed'
- Columns are date. Â I have 5 dates showing at any one time across the top. Â The date field is set up as a parameter so depending on the date the user selects, the report will show that date on the end column and then the 4 days prior to that in the other columns. Â Â
 - Data is the number of records.
I have a sub total on the Product and the report is collapsed on Product as default.
What i'm stuck on is trying to insert a column at the very end that will show the variance between the last two dates. Â So the difference between the date the user selected (@date parameter) and the day before that.Â
I have a Table Having Date,Opening,Addition,Sale values where opening value comes in the very first row other times it is zero.
In ssrs how can i have a report showing closing value = Opening+Addition-Sale  in current row (it is simple for 1st row ). this closing be the opening value in next row and same formula to be continued...