I am trying to use this command to change the variable in where clause each time:
psexec servername -E cmd.EXE /c "sqlcmd -S servername /E -d dbname -v entertext="'%anything%'" -i c:myfoldermyscript.sql -o c:mypathoutput.sql"
myscript.sql is like:
select * from table_name
where summary like $(entertext);
This command works just for variables with single and exact word. It does not work for variables which has space between them or when I enter part of summary.In fact, I wanted to write something which the user be able to enter variable each time when he/she run this batch file. because I put this sqlcmd command in batch file( like this in oracle: "select * from table_name where summary = &entertext; " I was looking the same command in sql server , but I did not find it). I do not know .net or any other programing language( I know just csh and command line). I want to do this just with sql command.
I am having trouble finding information on placing a % on a table value for a column of information in SSRS. I can do a "round" but cannot find how to include a % to the percentage. I just see SQL solution which I already know.
Hi Guys, I have a website with multiple pages and when a user signs in it puts a 1 in the database and their online status is shown to the rest of the members, if they use my signout button which I have on each page, it signs them out and updates the database with a 0 in the process, so shows them as then offline, my problem is some people forget to sign out and just close the browser window or begin surfing elsewhere. Is there a way to have sql server 2000 automatically change the field in the database after 30 minutes of inactivity. Or is there a way to automatically sign users out as they either click on the X in the browser window, or as they leave my site. Any help would be appreciated. Cheers
ALTER TABLE [konnik].[PORTAL_CONFIG] ADD CONSTRAINT [DF_PORTAL_CONFIG_AUTOPM_ON] DEFAULT (1) FOR [AUTOPM_ON]
and i received the following warning
Warning: The table 'PORTAL_CONFIG' has been created but its maximum row size (12068) exceeds the maximum number of bytes per row (8060). INSERT or UPDATE of a row in this table will fail if the resulting row length exceeds 8060 bytes.
Bear in mind that this table come from Access through the Dts. Could anyone translate this for me? How can i overcome this???
i found one tutorial on self signing assemblies for use in sql server, but it appears to have errors. does anyone know of a better tutorial on this topic? the site im currently looking at is here: http://www.sqljunkies.com/WebLog/ktegels/articles/SigningSQLCLRAssemblies.aspx
I have the following query where I am selecting the random row. However I need to select 10% randon rows from the tables. How do I do this? select top 1 * from table ORDER BY NEWID()
I need rate to be a percent, it is returning 1 where XX=YY (e.g 100/100=1), but when the number (rate) is a fraction (90/100=.9)I am getting 0. Don't know what the problem is.
select XX as X, YY as Y, (YY/XX) as rate from blah where blah group by XX, YY order by XX
I have come across a bit of problem with my Web Form. I have standard textbox which inserts a value into a SQL 2000 database. However if I put a pound sign anywhere inside the text box and do the insert it disappears when I try and reshow the value.
I have checked the database field to see if it has been inputted but its no where to be seen.
I have a SQL 7 db that I use a DTS package to import Oracle data into. The package works fine and imports all the appropriate data. However, if I use an Access 2000 database to attach to the data via ODBC (using the MS SQL Server driver), the negative sign is dropped when displaying data in a table, query, or report.
Same problem in SQL Server - if I query the SQL 7 data via the Query Analyzer, the negative signs are dropped. However, if I query the SQL data using the Enterprise Manager (i.e., Open Table...Return All Rows via right click on the table), the data shows up properly with the negative signs there. Bottom line - the data is correct, but doesn't get displayed correctly in QA or via ODBC.
What gives?! Can anyone explain to me the "connections" that occur between EM and QA? Looks like QA uses a "temporary" ODBC connection to talk to the data, while the EM connects "directly" to the data. Also, what gives with the MS SQL Server ODBC driver - why wouldn't it display the negative signs? Is there a better SQL Server ODBC driver that I should/could use? I've tried configuring the ODBC connection differently, but to no avail.
Any help is greatly appreciated, as the data in question is being used in court and absolutely HAS to be accurately displayed. Thanks! Jeff Jones Atlanta, GA
Does anyone know to include the Euro sign in SQL statements. I found an Ascii code of ALt+0128, but then I use CHAR (0128) it actually prints the Char (128) which is Ç not €. When I use the € directly in the code the application just shows a ?
I have a query where I have to use the convert function to return the unitprice as a decimal with 2 digits to the right of the decimal and a $ to the left of the number like 10 should be $10.0o. How do i insert the $. this is my code so far:
SELECT CONVERT(varchar, UnitPrice, 1) AS varchartotal FROM dbo.[Order Details]
I'm trying to import a text file which contains dates and decimal values. My problem is that the date has the following format "YYYY-MM-DD" and the decimal sign for the values are "." (dot).
If I change the "Locale" for the file source so it will handle the "." signs in the values then the dates are invalid, and if I have it so the dates are handled then the "."s aren't seen as decimals.
In Crystal Reports, there was a "reverse sign for display" property that could be checked for a number box. This was used for debits and credits (and such) so a negative number would be displayed as a positive and a positive displayed as a negative.
How would this work, or is there something simple, in Reporting Services?
Just lately I have noticed that I am periodically getting signed out of this forum. When I try and sign back in I get directed to an error page saying:
We apologize, but an unknown error has occured in the forums.
This error has been logged.
I would say this has been happening for a couple of weeks now at least.
I did all the step mentioned in this MSFT article http://msdn2.microsoft.com/en-us/library/ms137947.aspx Yet I can not sign a package using a certificate.
To sign a package
In Business Intelligence Development Studio, open the Integration Services project that contains the package you want to work with.
In Solution Explorer, double-click the package to open it.
In SSIS Designer, on the SSIS menu, click Digital Signing.
In the Digital Signing dialog box, click Sign.
The Select Certificate dialog box, select a certificate.
Optionally, click View Certificate to view certificate information.
Click OK to close the Select a Certificate dialog box.
Click OK to close the Digital Signing dialog box.
To save the updated package, click Save Selected Items on the File menu.
I don't see a certificate to select after following the article's steps. Can some one please shed some light on this?
Hi all whether using TOP clause in SELECT statement or [SET ROWCOUNT n] before SELECT statement, I want to know how SqlServer Behave? whether Fetching data and then choosing n record of them or as soon as fetching n records , Sql Server Stops retrieving the rest of the data? Thanks in advance. Regards.
I have questions table and questions are categorized. I want to query say Top 10 questions but with some percentage based on category. For example, if I have 10 questions in category 1 and 50 questions in category 2 than when I select Top 10 with some percentage I want to come out more questions from category 2 than category 1.
I'd like to understant the Percent Log Used behavior... I monitored the Percent Log Used. For a specific database, it was 50 % used. I backup up the transaction log and the Percent Log Used was still 50 % used. For another database, the log was 60 % used. After the backup, it was 80 % used!!!! Would you help me to understant this situation? Thank you, Fabio
I am trying to take a string code seen below that gives me the income over a 12 month time frame but now I need to take this string and divide it by the acqcost. and it will not let me can you please take a look at this and see whats wrong.
(This string is what gives me the income) =sum(Fields!Total.Value)-Sum(IIF(Fields!eqprecdt.Value< #6/1/2007#,Fields!bookvalue.Value* 0.07,Fields!bookvalue.Value* 0.07*-1 * datediff("d",#5/31/2008#,Fields!eqprecdt.Value)/365))
(This string is the acq cost) SUM(Fields!acqcost.Value)
Hi all As you are aware we have TOP n [Percent] keyword that is used in Select statements ,I have a question?? When this keyword is evaluated by Sql-Server, after retreiving all Query-Result or upon the number of results reach to the specified number,sql-server stops retrieving the rest of record.?
I a bit of newbie making reports and I cant figure out how to calculate the Percent of Total on a report. Assuming I have a field in my datatable called Color, I simply want to create a report that counts the occurences of each color and then perform a calculation as to what percent of the total that each of the colors make up. Basically a report that looks like this....
Color Count Percent Red 50 25% Blue 100 50%
Green 50 25% Total 200
I have a table that has a header, a grouping row based on Color, and a footer. So using the report expressions, my table looks like this
Color Count Percent =Fields!Color.Value =Count(Fields!Color.Value) WHAT EXPRESSION GOES HERE?!?!?!
I have a table of data, shown below that is composed of a scoreid, player id, and score. Using the following SQL Query: "Select Top 50 Percent(score), playerid, scoreid from TScores where playerid = 5 order by score" I can get the lowest 50% of player number 5's scores. How do I rewrite the query to give me each individual player's top 50 percent.
How can I remove the - after an import into a database. I want to be able to convert all negative numbers to positive, once the data has been imported into the table
I have imported a table from Oracle to SQL server using the tool in enterprise manager.
Some of the columns were numeric and had negative values.
In Query analyzer these numbers show up as positive. But when i add a where clause and only ask for the values < 0 the same numbers show up bit still without a negative sign.
Does anyone have an explanation for this? (could have found some help if the search function was working....)
I have a SSAS 2012 Tabular Cube and I am now stuck with a problem concerning something recursive in DAX.Basically I am looking for number of zones jump, provided the sign of the numbers are reverse.E.g. in the figure below. Number of zones jump for the figure -47,067 is 1, since there is a positive value in zone 2. If the Figure in Zone2 had been 0 or a negative number and Zone 3 had the same (i.e. 0 or a negative number) and Zone 4 had a positive number, the number of Zones jump would be 3. Is this something that could be done in DAX?Â